1 /** 2 * The Render Engine 3 * BaseBehavior 4 * 5 * @fileoverview The base for all behaviors. 6 * 7 * @author: Brett Fattori (brettf@renderengine.com) 8 * @author: $Author: bfattori $ 9 * @version: $Revision: 1555 $ 10 * 11 * Copyright (c) 2011 Brett Fattori (brettf@renderengine.com) 12 * 13 * Permission is hereby granted, free of charge, to any person obtaining a copy 14 * of this software and associated documentation files (the "Software"), to deal 15 * in the Software without restriction, including without limitation the rights 16 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 * copies of the Software, and to permit persons to whom the Software is 18 * furnished to do so, subject to the following conditions: 19 * 20 * The above copyright notice and this permission notice shall be included in 21 * all copies or substantial portions of the Software. 22 * 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 29 * THE SOFTWARE 30 */ 31 32 // Load all required engine components 33 R.Engine.define({ 34 "class":"R.components.logic.behaviors.BaseBehavior", 35 "requires":[ 36 "R.components.Logic" 37 ] 38 }); 39 40 /** 41 * @class The base behavior component. 42 * @extends R.components.Logic 43 * @constructor 44 */ 45 R.components.logic.behaviors.BaseBehavior = function () { 46 "use strict"; 47 return R.components.Logic.extend(/** @scope R.components.logic.behaviors.BaseBehavior.prototype */{ 48 49 transformComponent:null, 50 51 /** @private */ 52 constructor:function (name) { 53 this.base(name); 54 }, 55 56 reset:function () { 57 this.transformComponent = null; 58 this.base(); 59 }, 60 61 /** 62 * Sets the transformation component which contains this behavior. 63 * @param component {R.components.transform.BehaviorMover2D} The behavior mover component 64 */ 65 setTransformComponent:function (component) { 66 this.transformComponent = component; 67 }, 68 69 /** 70 * Gets the transformation component which contains this behavior. 71 * @return {R.components.transform.BehaviorMover2D} 72 */ 73 getTransformComponent:function () { 74 return this.transformComponent; 75 } 76 77 }, /** @scope R.components.logic.behaviors.BaseBehavior.prototype */{ 78 getClassName:function () { 79 return "R.components.logic.behaviors.BaseBehavior"; 80 } 81 }); 82 }; 83