/// <summary>
        /// Call this to initialize a Behaviour with data supplied in a file.
        /// </summary>
        /// <param name="fileName">The file to load from.</param>
        public override void LoadContent(String fileName)
        {
            base.LoadContent(fileName);

            //ExampleDefinition def = GameObjectManager.pInstance.pContentManager.Load<ExampleDefinition>(fileName);

            mSetSpriteFxMsg = new SpriteRender.SetSpriteEffectsMessage();
        }
        /// <summary>
        /// Call this to initialize a Behaviour with data supplied in a file.
        /// </summary>
        /// <param name="fileName">The file to load from.</param>
        public override void LoadContent(String fileName)
        {
            base.LoadContent(fileName);

            //ExampleDefinition def = GameObjectManager.pInstance.pContentManager.Load<ExampleDefinition>(fileName);

            mSetSpriteFxMsg = new SpriteRender.SetSpriteEffectsMessage();
        }
Beispiel #3
0
        /// <summary>
        /// Call this to initialize a Behaviour with data supplied in a file.
        /// </summary>
        /// <param name="fileName">The file to load from.</param>
        public override void LoadContent(String fileName)
        {
            PartnerDefinition def = GameObjectManager.pInstance.pContentManager.Load<PartnerDefinition>(fileName);

            base.LoadContent(fileName);

            //DamageFlashDefinition def = GameObjectManager.pInstance.pContentManager.Load<DamageFlashDefinition>(fileName);
            
            mBallClassifications = new List<MBHEngineContentDefs.GameObjectDefinition.Classifications>(1);
            mBallClassifications.Add(MBHEngineContentDefs.GameObjectDefinition.Classifications.VOLLEY_BALL);

            mCollisionResults = new List<GameObject>(16);

            mStateTimer = StopWatchManager.pInstance.GetNewStopWatch();

            mHitCount = 0;

            mFxBump = GameObjectManager.pInstance.pContentManager.Load<SoundEffect>("Audio\\FX\\Bump");

            mStartingRenderPriority = mParentGOH.pRenderPriority;

            mSetActiveAnimationMsg = new SpriteRender.SetActiveAnimationMessage();
            mSetSpriteEffectsMsg = new SpriteRender.SetSpriteEffectsMessage();
            mGetCurrentStateMsg = new Player.GetCurrentStateMessage();
            mGetCurrentHitCountMsg = new HitCountDisplay.GetCurrentHitCountMessage();
        }
Beispiel #4
0
        /// <summary>
        /// Call this to initialize a Behaviour with data supplied in a file.
        /// </summary>
        /// <param name="fileName">The file to load from.</param>
        public override void LoadContent(String fileName)
        {
            base.LoadContent(fileName);

            mCurrentState = State.Idle;

            mBallClassifications = new List<MBHEngineContentDefs.GameObjectDefinition.Classifications>(1);
            mBallClassifications.Add(MBHEngineContentDefs.GameObjectDefinition.Classifications.VOLLEY_BALL);

            mCollisionResults = new List<GameObject>(16);

            mStateTimer = StopWatchManager.pInstance.GetNewStopWatch();

            mKabooomAvail = true;

            mFxHit = GameObjectManager.pInstance.pContentManager.Load<SoundEffect>("Audio\\FX\\HitOpponent");
            mFxHitGround = GameObjectManager.pInstance.pContentManager.Load<SoundEffect>("Audio\\FX\\HitOpponentLand");
            
            mSetActiveAnimationMsg = new SpriteRender.SetActiveAnimationMessage();
            mSetSpriteEffectsMsg = new SpriteRender.SetSpriteEffectsMessage();
            mGetAttachmentPointMsg = new SpriteRender.GetAttachmentPointMessage();
            mGetCurrentStateMsg = new Player.GetCurrentStateMessage();
            mGetCurrentHitCountMsg = new HitCountDisplay.GetCurrentHitCountMessage();
        }
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            // Which type of message was sent to us?
            if (msg is SpriteRender.GetSpriteEffectsMessage)
            {
                SpriteRender.GetSpriteEffectsMessage temp = (SpriteRender.GetSpriteEffectsMessage)msg;
                temp.mSpriteEffects_Out = mSpriteEffects;
                msg = temp;
            }
            else if (msg is SpriteRender.SetSpriteEffectsMessage)
            {
                SpriteRender.SetSpriteEffectsMessage temp = (SpriteRender.SetSpriteEffectsMessage)msg;
                mSpriteEffects = temp.mSpriteEffects_In;
            }
            else if (msg is GetActiveAnimationMessage)
            {
                SpriteRender.GetActiveAnimationMessage temp = (SpriteRender.GetActiveAnimationMessage)msg;
                temp.mAnimationSetName_Out = mAnimations[mActiveAnimation].mName;
                msg = temp;
            }
            else if (msg is SetActiveAnimationMessage)
            {
                SpriteRender.SetActiveAnimationMessage temp = (SpriteRender.SetActiveAnimationMessage)msg;

                // If the animation is not currently playing we need to find it.
                if (mAnimations[mActiveAnimation].mName != temp.mAnimationSetName_In)
                {
                    Boolean animationFound = false;

                    for (int i = 0; i < mAnimations.Count; i++)
                    {
                        if (mAnimations[i].mName == temp.mAnimationSetName_In)
                        {
                            mActiveAnimation       = i;
                            mCurrentAnimationFrame = 0;
                            mAnimations[mActiveAnimation].mAnimationComplete = false;
                            animationFound = true;
                            break;
                        }
                    }

                    System.Diagnostics.Debug.Assert(animationFound, "Attempting to set unknown Animation: " + temp.mAnimationSetName_In);
                }
                // In the case where it is a non-looping animation which has completed, we need to reset the
                // animation to the beginning.
                // If it is a looping animation we don't do anything and assume that they just wanted to continue
                // the animation.
                else if (mAnimations[mActiveAnimation].mAnimationComplete)
                {
                    mCurrentAnimationFrame = 0;
                    mAnimations[mActiveAnimation].mAnimationComplete = false;
                }
            }
            else if (msg is GetAttachmentPointMessage)
            {
                GetAttachmentPointMessage temp = (GetAttachmentPointMessage)msg;

                FindAttachmentPointInWorldSpace(temp.mName_In, ref temp.mPoisitionInWorld_Out);
            }
            else if (msg is SetColorMessage)
            {
                SetColorMessage temp = (SetColorMessage)msg;
                mColor = temp.mColor_In;
            }
            else if (msg is SetTintMessage)
            {
                SetTintMessage temp = (SetTintMessage)msg;
                mTint = temp.mColor_In;
            }
            else if (msg is GetTexture2DMessage)
            {
                GetTexture2DMessage temp = (GetTexture2DMessage)msg;
                temp.mTexture_Out = mTexture;
            }
        }