tailieunhanh - Object oriented Game Development -P15
Object oriented Game Development -P15: There’s a better than 50% chance that you have picked this title off the shelf in a bookshop and are wondering if it’s going to be another one of those ‘secrets of the inner circle’ type of titles. You know, the ones that promise to tell you unspoken truths on how to write really cool games but in reality offer up a rehash of a manual you may already have for free anyway. | 406 Object-oriented game development private float m_fMinSpeed float m_fMaxSpeed --------------------------------------------------------- class HasSpin public HasSpin HasSpin float fMin float fMax float GetSpin const void SetSpinRange float fMin float fMax private float m_fMinSpin float m_fMaxSpin --------------------------------------------------------- class HasDirection public HasDirection HasDirection const MATHS Vector3 vDir float fPerturbation void SetDirection const MATHS Vector3 vDir Set the direction vector. void SetPerturbation float fPerturbation Sets the amount of randomness in the direction. MATHS Vector3 GetVelocityVector float fSpeed const private MATHS Vector3 m_vDirection float m_fPerturbation Case study Cordite 407 class Emitter public Constants typedefs enums. Lifecycle. Emitter const MATHS Vector3 vPosition Polymorphism. API. const MATHS Vector3 GetPosition const void SetPosition const MATHS Vector3 vPos Set get the point of emission. protected Helpers. private Data. MATHS Vector3 m_vPosition end class ---------------------- class EmitterDirectional public Emitter public HasSpeed public HasDirection 408 Object-oriented game development public Constants typedefs enums. Lifecycle. EmitterDirectional const MATHS Vector3 vPos const MATHS Vector3 vDir float fMinSpeed float fMaxSpeed float fPerturbation Polymorphism. API. MATHS Vector3 GetParticleVelocity const Gets a velocity based on the direction speed and perturbation settings. protected Helpers. private Data. float m_fPerturbation end class There are no virtual function calls required here so it s all nice and quick. Notice that there is no create particle call in the Emitter. The function of this object is to calculate initial values and it does this by having ranges .
đang nạp các trang xem trước