コード例 #1
0
ファイル: GameObject.cs プロジェクト: YashBagriGDD/Current
 /// <summary>
 /// Add a new animation that can be able to be played by name
 /// </summary>
 /// <param name="newAnimation"></param>
 public void AddAnimation(Animate newAnimation)
 {
     if (AnimationData.ContainsKey(newAnimation.Name))
     {
         AnimationData[newAnimation.Name] = newAnimation;
     }
     else
     {
         AnimationData.Add(newAnimation.Name, newAnimation);
     }
 }
コード例 #2
0
ファイル: GameObject.cs プロジェクト: YashBagriGDD/Current
        /// <summary>
        /// Initializes a GameObject
        /// </summary>
        /// <param name="texture">The texture to use for this Gameobject</param>
        public GameObject(string name, Texture2D texture, Rectangle location)
        {
            Name    = name;
            Texture = texture;
            GameManager.Add(Name, this);



            //Save start values
            Location          = location;
            SpawnLocation     = Location;
            LoadLocation      = location;
            initGameplayState = ActiveGameplayState;
            initGameState     = ActiveState;
            initMainmenuState = ActiveMainMenuState;

            //Setup Animation
            Animate defaultAnim = new Animate(Texture, 1, 1, Animate.ONESIXTIETHSECPERFRAME, this);

            AnimationData = new Dictionary <string, Animate>();
            AnimationData.Add(texture.Name, defaultAnim);
            currentAnimation = texture.Name;
        }