Esempio n. 1
0
 public Item(bool used, int stack, string name, Animations.HerdAnimation animation)
 {
     Used = used;
     Stack = stack;
     Name = name;
     this.animation = animation;
 }
 IEnumerator UncheckStateFlag(Animations flagHash)
 {
     yield return new WaitForEndOfFrame();
     Debug.Log("UncheckStateFlag");
     int hash = stateHashes[(int)flagHash];
     controller.SetBool(hash, false);
 }
Esempio n. 3
0
 void Start()
 {
     anim = GetComponent<Animator>();
     animations = (Animations)GameObject.FindObjectOfType(typeof(Animations));
     playerMove = (PlayerMove)GameObject.FindObjectOfType(typeof(PlayerMove));
     anim.Play("ramasIdle");
 }
Esempio n. 4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="id">a unique (for the map) ID</param>
 /// <param name="variables"></param>
 /// <param name="animations">always include an animation with the key "default"</param>
 public PhysicalObject(string id, Dictionary<string,string> variables, Animations.AnimationList animations)
     : base(id, variables)
 {
     Show = false;
     this.animations = animations;
     animations.SetAnimation("default");
 }
		//===========================================================
		// Overridden Particle System Functions
		//===========================================================
		protected override void  AfterInitialize()
		{
			base.AfterInitialize();

			// Setup the Animation
			mcExplosionAnimation = new Animations();
			mcButterflyAnimation = new Animations();

			// The Order of the Picture IDs to make up the Animation
			int[] iaAnimationOrder = new int[miNumberOfPicturesInAnimation];
			for (int iIndex = 0; iIndex < miNumberOfPicturesInAnimation; iIndex++)
			{
				iaAnimationOrder[iIndex] = iIndex;
			}

			// Create the Pictures and Animation and Set the Animation to use for Explosions
			mcExplosionAnimation.CreatePicturesFromTileSet(miNumberOfPicturesInAnimation, 16, new Rectangle(0, 0, 64, 64));
			int iAnimationID = mcExplosionAnimation.CreateAnimation(iaAnimationOrder, mfTimeBetweenAnimationImages, 1);
			mcExplosionAnimation.CurrentAnimationID = iAnimationID;

			// Create the Pictures and Animation and Set the Animation to use for Butterflies
			mcButterflyAnimation.CreatePicturesFromTileSet(16, 4, new Rectangle(0, 0, 128, 128));
			iAnimationID = mcButterflyAnimation.CreateAnimation(iaAnimationOrder, mfTimeBetweenAnimationImages, 0);
			mcButterflyAnimation.CurrentAnimationID = iAnimationID;
		}
Esempio n. 6
0
    public override void Animate(Animations zAnimation = Animations.MELEE_MID)
    {
        switch (zAnimation)
        {
            case Animations.RANGE_LEFT:
                Animator.SetTrigger("AttackRange");
                break;
            case Animations.RANGE_RIGHT:
                Animator.SetTrigger("AttackRangeB");
                break;
            case Animations.MELEE_QUICK:
                Animator.SetTrigger("AttackMelee");
                break;
            case Animations.MELEE_MID:
                Animator.SetTrigger("AttackMeleeB");
                break;
            case Animations.MELEE_SLOW:
                Animator.SetTrigger("AttackMeleeC");
                break;

            case Animations.START_WALKING:
                if (Animator.GetBool("StartWalking") == false)
                {
                    Animator.SetBool("StartWalking", true);
                }
                break;
            case Animations.IDLE:
                Animator.SetBool("StartWalking", false);
                break;
            case Animations.DAMAGED:
                Animator.SetTrigger("Damaged");
                break;
        }
    }
Esempio n. 7
0
 void Awake()
 {
     playerStats = GetComponent<PlayerStats>();
     References.stateManager.changeState += onChangeState;
     animations = GetComponentInChildren<Animations>();
     enemies = new System.Collections.Generic.List<GameObject>();
 }
Esempio n. 8
0
		public void AddCondition (Animations id, AnimationConditionHandler handler)
		{
			if (animation_conditions.ContainsKey (id))
				throw new Exception (string.Format ("Animation Condition Handler already contains callback for {0}", id));
			
			animation_conditions [id] = handler;
		}
Esempio n. 9
0
        /// <summary>
        /// Constructor call.  Creates a new Door object.
        /// </summary>
        /// <param name="content">The content manager to use when loading assets.</param>
        /// <param name="orient">The orientation of the room (either facing left or facing right).</param>
        /// <param name="roomName">The name of the room that the door leads to.</param>
        /// <param name="connectedDoorIndex">The index of the door that is linked to this one.</param>
        /// <param name="lockT">The type of lock that is on this door.</param>
        public Door(ContentManager content, AudioEngine audioEngine, DoorOrientations orient, string roomName, int connectedDoorIndex, Locks lockT)
            : base("Door", content)
        {
            Content = content;
            soundEngine = audioEngine;
            orientation = orient;
            linkedRoom = null;
            linkedRoomName = roomName;
            linkedDoorIndex = connectedDoorIndex;
            lockType = lockT;

            isOpen = false;
            isSolid = true;

            switch (lockType)
            {
                case Locks.Unlocked:
                    animation = Animations.Unlocked;
                    break;
                case Locks.Red:
                    animation = Animations.RedLock;
                    break;
                default:
                    animation = Animations.Unlocked;
                    break;
            }

            currentAnimation = (int)animation + (int)orientation;
        }
Esempio n. 10
0
		public bool this [Animations condition]
		{
			get { 
				if (!animation_conditions.ContainsKey (condition))
					return false;
				return animation_conditions [condition].Invoke (); 
			}
		}
Esempio n. 11
0
    void Update()
    {
        if (_character.health == 0) {
            // player is dead
            if (_currentAnimation != Animations.PlayerDeath) {
                _currentAnimation = Animations.PlayerDeath;
                _sprite.ShowFrame(0);

                //var currentPosition : Vector3 = transform.position;
                //var apex : Vector3 = currentPosition + (Vector3.up * 112);

                 // Calling Player.Respawn() oncomplete probably isn't the best bet in the long run.
                 // We not only want to respawn the player, but reset the level.
                 // Plan: Add a method to SceneController called Reset, and add a Reset method to
                 // every object that can/needs to be reset after player death.
                 //iTween.MoveTo(gameObject, {'path': [apex, currentPosition], 'easetype': 'linear', 'time': 1, 'oncomplete': 'Respawn' });
            }
        } else {
            if (_character.facing == Vector2.right) {
                if (_character.isWalking) {
                    if (_currentAnimation != Animations.WalkRight) {
                        _currentAnimation = Animations.WalkRight;
                        _sprite.ShowFrame(13);
                        _sprite.Play("WalkRight");
                    }
                } else if (_character.isJumping) {
                    if (_currentAnimation != Animations.JumpRight) {
                        _currentAnimation = Animations.JumpRight;
                        _sprite.ShowFrame(2);
                    }
                } else {
                    if (_currentAnimation != Animations.StandRight) {
                        _currentAnimation = Animations.StandRight;
                        _sprite.ShowFrame(7);
                    }
                }
            } else {
                // player is facing left
                if (_character.isWalking) {
                    if (_currentAnimation != Animations.WalkLeft) {
                        _currentAnimation = Animations.WalkLeft;
                        _sprite.ShowFrame(10);
                        _sprite.Play("WalkLeft");
                    }
                } else if (_character.isJumping) {
                    if (_currentAnimation != Animations.JumpLeft) {
                        _currentAnimation = Animations.JumpLeft;
                        _sprite.ShowFrame(1);
                    }
                } else {
                    if (_currentAnimation != Animations.StandLeft) {
                        _currentAnimation = Animations.StandLeft;
                        _sprite.ShowFrame(6);
                    }
                }
            }
        }
    }
Esempio n. 12
0
        public Player(string charName, Classes className, int level, int ultimatePointsToCast, Animations.Animation standardAnimation, Animations.Animation attackanimation, Animations.Animation deathAnimation)
            : base(charName, className, level, ultimatePointsToCast, standardAnimation, attackanimation, deathAnimation)
        {
            this.HiddenName = this.JosDemon;
            this.AngelExp = 0;
            this.DemonExp = 0;

            LoadSkillHelperClass.AddSkillsToParty(this);
        }
Esempio n. 13
0
		public void LoadSprites(Animations.Animation animation)
		{
			if (animation == null) throw new ArgumentNullException("animation");

			foreach (Animations.AnimationElement element in animation)
			{
				GetSprite(element.SpriteId);
			}
		}
Esempio n. 14
0
		/// <summary>
		/// Initializes a new instance of this class.
		/// </summary>
		/// <param name="spritemanager">The xnaMugen.Sprites.SpriteManager used by all backgrounds in this collection.</param>
		/// <param name="animationmanager">The xnaMugen.Animations.AnimationManager used by all backgrounds in this collection.</param>
		public Collection(Drawing.SpriteManager spritemanager, Animations.AnimationManager animationmanager)
		{
			if (spritemanager == null) throw new ArgumentNullException("spritemanager");
			if (animationmanager == null) throw new ArgumentNullException("animationmanager");

			m_backgrounds = new List<Base>();
			m_spritemanager = spritemanager;
			m_animationmanager = animationmanager;
		}
Esempio n. 15
0
 void Start()
 {
     instancerHouse2 = (InstancerHouse2)GameObject.FindObjectOfType(typeof(InstancerHouse2));
     animations = (Animations)GameObject.FindObjectOfType(typeof(Animations));
     gui = (Gui)GameObject.FindObjectOfType(typeof(Gui));
     inventory = (Inventory)GameObject.FindObjectOfType(typeof(Inventory));
     anim = GetComponent<Animator>();
     anim.Play("armarioClosed");
 }
Esempio n. 16
0
 void Start()
 {
     animations = (Animations)GameObject.FindObjectOfType(typeof(Animations));
     gui = (Gui)GameObject.FindObjectOfType(typeof(Gui));
     inventory = (Inventory)GameObject.FindObjectOfType(typeof(Inventory));
     playerMove = (PlayerMove)GameObject.FindObjectOfType(typeof(PlayerMove));
     anim = GetComponent<Animator>();
     anim.Play("doorBathClosed");
 }
Esempio n. 17
0
 void Start()
 {
     animations = (Animations)GameObject.FindObjectOfType(typeof(Animations));
     gui = (Gui)GameObject.FindObjectOfType(typeof(Gui));
     inventory = (Inventory)GameObject.FindObjectOfType(typeof(Inventory));
     instancer = (Instancer)GameObject.FindObjectOfType(typeof(Instancer));
     anim = GetComponent<Animator>();
     anim.Play("statueIdle");
 }
    public void HeavyAttack()
    {
        if (previousAnimation != Animations.heavyattack)
        {
            ResetTriggers();
            myAnimator.SetTrigger("heavyattack");
        }

        previousAnimation = Animations.heavyattack;
    }
Esempio n. 19
0
		public Animated(TextSection textsection, Drawing.SpriteManager spritemanager, Animations.AnimationManager animationmanager)
			: base(textsection)
		{
			if (spritemanager == null) throw new ArgumentNullException("spritemanager");
			if (animationmanager == null) throw new ArgumentNullException("animationmanager");

			m_spritemanager = spritemanager;
			m_animationmanager = animationmanager;
			m_animationnumber = textsection.GetAttribute<Int32>("actionno", Int32.MinValue);
		}
 void Start()
 {
     rb = GetComponent<Rigidbody>();
     rb.mass = 0.5f;
     movement = new Vector3 (0, 0, 1); //a força sobre o atleta para move-lo para a frente
     animations = GetComponent<Animations>();
     b = GameObject.Find ("ArmStrokes").GetComponent<ArmStrokes>();
     cam = GameObject.Find ("Main Camera").GetComponent<CameraController>();
     Sounds = GameObject.Find ("Sounds").GetComponent<SwimmingSounds>();
 }
Esempio n. 21
0
    void Start()
    {
        Cam = GameObject.Find ("Cam");
        MainCam = GameObject.Find ("Main Camera");
        animations = GameObject.Find ("Player").GetComponent<Animations>();

        t = GetComponent<Timer> ();
        camController = MainCam.GetComponent<CameraController> ();
        playerController = GameObject.Find ("Player").GetComponent<PlayerControl>();
    }
    public void LightAttack()
    {
        if (previousAnimation != Animations.lightattack)
        {
            ResetTriggers();
            myAnimator.SetTrigger("lightattack");
        }

        previousAnimation = Animations.lightattack;
    }
 public void Idle()
 {
     if(previousAnimation != Animations.idle)
     {
         ResetTriggers();
         myAnimator.SetTrigger("idle");
     }
             
     previousAnimation = Animations.idle;
 }
Esempio n. 24
0
		public void SetForeignAnimation(Animations.AnimationManager animationmanager, Int32 animationnumber, Int32 elementnumber)
		{
			if (AnimationManager.SetForeignAnimation(animationmanager, animationnumber, elementnumber) == true)
			{
				SpriteManager.LoadSprites(AnimationManager.CurrentAnimation);
			}
			else
			{
			}

		}
Esempio n. 25
0
 public Character()
 {
     _boundingBox = new Rectangle(0, 0, 30, 30);
     _origin = Vector2.Zero;
     _position = new Vector2(50, 50);
     Speed = 6.0f;
     _jumpHeight = Vector2.Zero;
     Direction = Directions.Right;
     _animations = new Animations();
     Moving = false;
 }
 public void WalkRight()
 {
     if (previousAnimation != Animations.walkRight)
     {
         ResetTriggers();
         mySpriteRenderer.flipX = false;
         myAnimator.SetTrigger("walk");
     }
     
     previousAnimation = Animations.walkRight;
 }
Esempio n. 27
0
        protected override void Parse(EndianBinaryReader r)
        {
            EID = ReadVarInt(r);
            Animate = (Animations)r.ReadByte();

            #if DEBUGPACKET
            if (Animate.ToString() == ((int)Animate).ToString())
                throw new NotImplementedException(Animate.ToString());
            #endif

        }
		public void StartAnimation(Animations whichAnimation)
		{
			Task start = RunInUiThreadAsync(delegate
			{
				if (_animations.GetUpperBound(0) >= (int)whichAnimation && (int)whichAnimation >= 0)
				{
					// Storyboard sb = _animations[whichAnimation];
					Storyboard sb = _animations[(int)whichAnimation];
					sb?.Begin();
				}
			});
		}
Esempio n. 29
0
        public Scene()
        {
            Layers = new Layers();

            AllLayers = new Layers();

            Animations = new Animations();

            ScriptFiles = new List<string>();

            Maps = new Maps();
        }
Esempio n. 30
0
    void Awake()
    {
        References.stateManager.changeState += onChangeState;
        playerStats = GetComponent<PlayerStats>();
        playerAttacks = GetComponent<PlayerKeyboardAttacks>();
        rigidbody = GetComponent<Rigidbody>();
        animations = GetComponentInChildren<Animations>();

        groundedMaxYVelocity = 5;
        airMaxYVelocity = -15;
        minYVelocity = -100;
        distanceCheck = 2.25f;
    }
Esempio n. 31
0
        private bool LoadXml()
        {
            string path = FiddlerControls.Options.AppDataPath;

            string FileName = Path.Combine(path, "Animationlist.xml");

            if (!(File.Exists(FileName)))
            {
                return(false);
            }
            TreeViewMobs.BeginUpdate();
            TreeViewMobs.Nodes.Clear();


            XmlDocument dom = new XmlDocument();

            dom.Load(FileName);
            XmlElement      xMobs = dom["Graphics"];
            List <TreeNode> nodes = new List <TreeNode>();
            TreeNode        rootnode, node, typenode;

            rootnode      = new TreeNode("Mobs");
            rootnode.Name = "Mobs";
            rootnode.Tag  = -1;
            nodes.Add(rootnode);

            foreach (XmlElement xMob in xMobs.SelectNodes("Mob"))
            {
                string name;
                int    value;
                name  = xMob.GetAttribute("name");
                value = int.Parse(xMob.GetAttribute("body"));
                int type = int.Parse(xMob.GetAttribute("type"));
                node             = new TreeNode(name);
                node.Tag         = new int[] { value, type };
                node.ToolTipText = Animations.GetFileName(value);
                rootnode.Nodes.Add(node);

                for (int i = 0; i < AnimNames[type].GetLength(0); ++i)
                {
                    if (Animations.IsActionDefined(value, i, 0))
                    {
                        typenode     = new TreeNode(i.ToString() + " " + AnimNames[type][i]);
                        typenode.Tag = i;
                        node.Nodes.Add(typenode);
                    }
                }
            }
            rootnode      = new TreeNode("Equipment");
            rootnode.Name = "Equipment";
            rootnode.Tag  = -2;
            nodes.Add(rootnode);

            foreach (XmlElement xMob in xMobs.SelectNodes("Equip"))
            {
                string name;
                int    value;
                name  = xMob.GetAttribute("name");
                value = int.Parse(xMob.GetAttribute("body"));
                int type = int.Parse(xMob.GetAttribute("type"));
                node             = new TreeNode(name);
                node.Tag         = new int[] { value, type };
                node.ToolTipText = Animations.GetFileName(value);
                rootnode.Nodes.Add(node);

                for (int i = 0; i < AnimNames[type].GetLength(0); ++i)
                {
                    if (Animations.IsActionDefined(value, i, 0))
                    {
                        typenode     = new TreeNode(i.ToString() + " " + AnimNames[type][i]);
                        typenode.Tag = i;
                        node.Nodes.Add(typenode);
                    }
                }
            }
            TreeViewMobs.Nodes.AddRange(nodes.ToArray());
            nodes.Clear();
            TreeViewMobs.EndUpdate();
            return(true);
        }
        public EnemySpriteManager(ContentManager content, Vector2 drawLoc, string enemyName)
        {
            // Load in all of the sprites for our animation
            idleImg     = content.Load <Texture2D>($"Images/Sprites/{enemyName}/Idle");
            uppercutImg = content.Load <Texture2D>($"Images/Sprites/{enemyName}/Uppercut");
            hookImg     = content.Load <Texture2D>($"Images/Sprites/{enemyName}/Hook");
            blockImg    = content.Load <Texture2D>($"Images/Sprites/{enemyName}/Block");
            slipImg     = content.Load <Texture2D>($"Images/Sprites/{enemyName}/Slip");
            crossImg    = content.Load <Texture2D>($"Images/Sprites/{enemyName}/Cross");
            jabImg      = content.Load <Texture2D>($"Images/Sprites/{enemyName}/Jab");
            downImg     = content.Load <Texture2D>($"Images/Sprites/{enemyName}/Down");

            // Store the dimensions of each of the spritesheets
            int[] idleDimensions     = new int[3];
            int[] uppercutDimensions = new int[3];
            int[] hookDimensions     = new int[3];
            int[] blockDimensions    = new int[3];
            int[] slipDimensions     = new int[3];
            int[] crossDimensions    = new int[3];
            int[] jabDimensions      = new int[3];
            int[] downDimensions     = new int[3];

            // Change them based on the enemy loaded
            if (enemyName == "Aoyama")
            {
                idleDimensions     = new int[] { 12, 1, 12 };
                uppercutDimensions = new int[] { 4, 1, 4 };
                hookDimensions     = new int[] { 4, 1, 4 };
                blockDimensions    = new int[] { 5, 1, 5 };
                slipDimensions     = new int[] { 2, 1, 2 };
                crossDimensions    = new int[] { 6, 1, 6 };
                jabDimensions      = new int[] { 3, 1, 3 };
                downDimensions     = new int[] { 3, 1, 3 };
            }
            else if (enemyName == "Nishi")
            {
                idleDimensions     = new int[] { 6, 1, 6 };
                uppercutDimensions = new int[] { 4, 1, 4 };
                hookDimensions     = new int[] { 5, 1, 5 };
                blockDimensions    = new int[] { 2, 1, 2 };
                slipDimensions     = new int[] { 2, 1, 2 };
                crossDimensions    = new int[] { 4, 1, 4 };
                jabDimensions      = new int[] { 2, 1, 2 };
                downDimensions     = new int[] { 4, 1, 4 };
            }
            else if (enemyName == "Wolf")
            {
                idleDimensions     = new int[] { 3, 1, 3 };
                uppercutDimensions = new int[] { 3, 1, 3 };
                hookDimensions     = new int[] { 3, 1, 3 };
                blockDimensions    = new int[] { 2, 1, 2 };
                slipDimensions     = new int[] { 2, 1, 2 };
                crossDimensions    = new int[] { 3, 1, 3 };
                jabDimensions      = new int[] { 2, 1, 2 };
                downDimensions     = new int[] { 2, 1, 2 };
            }
            else if (enemyName == "Rikiishi")
            {
                idleDimensions     = new int[] { 4, 1, 4 };
                uppercutDimensions = new int[] { 2, 1, 2 };
                hookDimensions     = new int[] { 2, 1, 2 };
                blockDimensions    = new int[] { 2, 1, 2 };
                slipDimensions     = new int[] { 2, 1, 2 };
                crossDimensions    = new int[] { 2, 1, 2 };
                jabDimensions      = new int[] { 2, 1, 2 };
                downDimensions     = new int[] { 6, 1, 6 };
            }

            // Add the animation to the animations dictionary
            Animations.Add("Idle", new Animation(idleImg, idleDimensions[0], idleDimensions[1], idleDimensions[2], 0, 0, Animation.ANIMATE_FOREVER, 30, drawLoc, 1.75f, true));
            Animations.Add("Uppercut", new Animation(uppercutImg, uppercutDimensions[0], uppercutDimensions[1], uppercutDimensions[2], 0, uppercutDimensions[2], Animation.ANIMATE_ONCE, 30, drawLoc, 1.75f, true));
            Animations.Add("Hook", new Animation(hookImg, hookDimensions[0], hookDimensions[1], hookDimensions[2], 0, hookDimensions[2], Animation.ANIMATE_ONCE, 30, drawLoc, 1.75f, true));
            Animations.Add("Block", new Animation(blockImg, blockDimensions[0], blockDimensions[1], blockDimensions[2], 0, blockDimensions[2], Animation.ANIMATE_ONCE, 30, drawLoc, 1.75f, true));
            Animations.Add("Slip", new Animation(slipImg, slipDimensions[0], slipDimensions[1], slipDimensions[2], 0, slipDimensions[2], Animation.ANIMATE_ONCE, 30, drawLoc, 1.75f, true));
            Animations.Add("Cross", new Animation(crossImg, crossDimensions[0], crossDimensions[1], crossDimensions[2], 0, crossDimensions[2], Animation.ANIMATE_ONCE, 30, drawLoc, 1.75f, true));
            Animations.Add("Jab", new Animation(jabImg, jabDimensions[0], jabDimensions[1], jabDimensions[2], 0, jabDimensions[2], Animation.ANIMATE_ONCE, 30, drawLoc, 1.75f, true));
            Animations.Add("Down", new Animation(downImg, downDimensions[0], downDimensions[1], downDimensions[2], 0, downDimensions[2], Animation.ANIMATE_ONCE, 30, drawLoc, 1.75f, true));

            // Set the default current animation
            CurrentAnimation = "Idle";
        }
Esempio n. 33
0
    /// <summary>
    /// Creates a wall at the given location, using the correct tile given which sides are connected to other walls.
    /// </summary>
    /// <param name="loc"></param>
    /// <param name="isAbove">Is the top of this wall connected to another wall?</param>
    /// <param name="isBelow">Is the bottom of this wall connected to another wall?</param>
    /// <param name="isLeft">Is the left side of this wall connected to another wall?</param>
    /// <param name="isRight">Is the right side of this wall connected to another wall?</param>
    private GameObject CreateWall(Location loc, GameObject style, bool isAbove, bool isBelow, bool isLeft, bool isRight)
    {
        if (WallContainer == null)
        {
            WallContainer = new GameObject("Walls").transform;
        }


        Animations tile = Animations.P_Run;

        #region Get proper tile.

        if (!isAbove && !isBelow && !isLeft && !isRight)
        {
            tile = Animations.W_Single;
        }

        else if (!isAbove && !isBelow && (isLeft || isRight))
        {
            tile = Animations.W_HorzCenter;
        }
        else if (!isLeft && !isRight && (isAbove || isBelow))
        {
            tile = Animations.W_VertCenter;
        }

        else if (!isLeft && !isRight && isAbove && !isBelow)
        {
            tile = Animations.W_TopEnd;
        }
        else if (!isLeft && !isRight && !isAbove && isBelow)
        {
            tile = Animations.W_BottomEnd;
        }
        else if (isLeft && !isRight && !isAbove && !isBelow)
        {
            tile = Animations.W_RightEnd;
        }
        else if (!isLeft && isRight && !isAbove && !isBelow)
        {
            tile = Animations.W_LeftEnd;
        }

        else if (isRight && isBelow && !isLeft && !isAbove)
        {
            tile = Animations.W_TLCorner;
        }
        else if (isRight && isAbove && !isLeft && !isBelow)
        {
            tile = Animations.W_BLCorner;
        }
        else if (isLeft && isBelow && !isRight && !isAbove)
        {
            tile = Animations.W_TRCorner;
        }
        else if (isLeft && isAbove && !isRight && !isBelow)
        {
            tile = Animations.W_BRCorner;
        }

        else if (isRight && !isLeft && isAbove && isBelow)
        {
            tile = Animations.W_LeftSide;
        }
        else if (isLeft && !isRight && isAbove && isBelow)
        {
            tile = Animations.W_RightSide;
        }
        else if (isAbove && !isBelow && isLeft && isRight)
        {
            tile = Animations.W_BottomSide;
        }
        else if (isBelow && !isAbove && isLeft && isRight)
        {
            tile = Animations.W_TopSide;
        }

        else if (isLeft && isRight && isAbove && isBelow)
        {
            tile = Animations.W_Center;
        }

        else
        {
            Debug.Log("Invalid wall tile: isAbove: " + isAbove + "; isBelow: " + isBelow + "; isLeft: " + isLeft + "; isRight: " + isRight);
        }

        #endregion


        GameObject wall = (GameObject)Instantiate(style);
        wall.layer = LayerMask.NameToLayer("Walls");
        Transform t = wall.transform;
        wall.name = "Wall";
        wall.GetComponent <Animator>().SetWallFrame(tile, wall.GetComponent <WallSheetData>());
        t.position = new Vector3(loc.X, loc.Y, t.position.z);
        t.parent   = WallContainer;

        return(wall);
    }
Esempio n. 34
0
        public override void ReadDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (ele.TryPathTo("EditorID", false, out subEle))
            {
                if (EditorID == null)
                {
                    EditorID = new SimpleSubrecord <String>();
                }

                EditorID.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("ObjectBounds", false, out subEle))
            {
                if (ObjectBounds == null)
                {
                    ObjectBounds = new ObjectBounds();
                }

                ObjectBounds.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Name", false, out subEle))
            {
                if (Name == null)
                {
                    Name = new SimpleSubrecord <String>();
                }

                Name.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Model", false, out subEle))
            {
                if (Model == null)
                {
                    Model = new Model();
                }

                Model.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("ActorEffects", false, out subEle))
            {
                if (ActorEffects == null)
                {
                    ActorEffects = new List <RecordReference>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    RecordReference tempSPLO = new RecordReference();
                    tempSPLO.ReadXML(e, master);
                    ActorEffects.Add(tempSPLO);
                }
            }
            if (ele.TryPathTo("Unarmed/AttackEffect", false, out subEle))
            {
                if (UnarmedAttackEffect == null)
                {
                    UnarmedAttackEffect = new RecordReference();
                }

                UnarmedAttackEffect.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Unarmed/AttackAnimation", false, out subEle))
            {
                if (UnarmedAttackAnimation == null)
                {
                    UnarmedAttackAnimation = new SimpleSubrecord <UInt16>();
                }

                UnarmedAttackAnimation.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Models", false, out subEle))
            {
                if (Models == null)
                {
                    Models = new SubNullStringList();
                }

                Models.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("TextureHashes", false, out subEle))
            {
                if (TextureHashes == null)
                {
                    TextureHashes = new SimpleSubrecord <Byte[]>();
                }

                TextureHashes.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("BaseStats", false, out subEle))
            {
                if (BaseStats == null)
                {
                    BaseStats = new CreatureBaseStats();
                }

                BaseStats.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Factions", false, out subEle))
            {
                if (Factions == null)
                {
                    Factions = new List <FactionMembership>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    FactionMembership tempSNAM = new FactionMembership();
                    tempSNAM.ReadXML(e, master);
                    Factions.Add(tempSNAM);
                }
            }
            if (ele.TryPathTo("DeathItem", false, out subEle))
            {
                if (DeathItem == null)
                {
                    DeathItem = new RecordReference();
                }

                DeathItem.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("VoiceType", false, out subEle))
            {
                if (VoiceType == null)
                {
                    VoiceType = new RecordReference();
                }

                VoiceType.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Template", false, out subEle))
            {
                if (Template == null)
                {
                    Template = new RecordReference();
                }

                Template.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Destructable", false, out subEle))
            {
                if (Destructable == null)
                {
                    Destructable = new Destructable();
                }

                Destructable.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Script", false, out subEle))
            {
                if (Script == null)
                {
                    Script = new RecordReference();
                }

                Script.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Contents", false, out subEle))
            {
                if (Contents == null)
                {
                    Contents = new List <InventoryItem>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    InventoryItem tempCNTO = new InventoryItem();
                    tempCNTO.ReadXML(e, master);
                    Contents.Add(tempCNTO);
                }
            }
            if (ele.TryPathTo("AIData", false, out subEle))
            {
                if (AIData == null)
                {
                    AIData = new AIData();
                }

                AIData.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Packages", false, out subEle))
            {
                if (Packages == null)
                {
                    Packages = new List <RecordReference>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    RecordReference tempPKID = new RecordReference();
                    tempPKID.ReadXML(e, master);
                    Packages.Add(tempPKID);
                }
            }
            if (ele.TryPathTo("Animations", false, out subEle))
            {
                if (Animations == null)
                {
                    Animations = new SubNullStringList();
                }

                Animations.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Data", false, out subEle))
            {
                if (Data == null)
                {
                    Data = new CreatureData();
                }

                Data.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("AttackReach", false, out subEle))
            {
                if (AttackReach == null)
                {
                    AttackReach = new SimpleSubrecord <Byte>();
                }

                AttackReach.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("CombatStyle", false, out subEle))
            {
                if (CombatStyle == null)
                {
                    CombatStyle = new RecordReference();
                }

                CombatStyle.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("BodyPartData", false, out subEle))
            {
                if (BodyPartData == null)
                {
                    BodyPartData = new RecordReference();
                }

                BodyPartData.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("TurningSpeed", false, out subEle))
            {
                if (TurningSpeed == null)
                {
                    TurningSpeed = new SimpleSubrecord <Single>();
                }

                TurningSpeed.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("BaseScale", false, out subEle))
            {
                if (BaseScale == null)
                {
                    BaseScale = new SimpleSubrecord <Single>();
                }

                BaseScale.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("FootWeight", false, out subEle))
            {
                if (FootWeight == null)
                {
                    FootWeight = new SimpleSubrecord <Single>();
                }

                FootWeight.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("ImpactMaterialType", false, out subEle))
            {
                if (ImpactMaterialType == null)
                {
                    ImpactMaterialType = new SimpleSubrecord <MaterialTypeUInt>();
                }

                ImpactMaterialType.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("SoundLevel", false, out subEle))
            {
                if (SoundLevel == null)
                {
                    SoundLevel = new SimpleSubrecord <SoundLevel>();
                }

                SoundLevel.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("SoundTemplate", false, out subEle))
            {
                if (SoundTemplate == null)
                {
                    SoundTemplate = new RecordReference();
                }

                SoundTemplate.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("SoundData", false, out subEle))
            {
                if (SoundData == null)
                {
                    SoundData = new List <CreatureSoundData>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    CreatureSoundData tempCSDT = new CreatureSoundData();
                    tempCSDT.ReadXML(e, master);
                    SoundData.Add(tempCSDT);
                }
            }
            if (ele.TryPathTo("ImpactDataset", false, out subEle))
            {
                if (ImpactDataset == null)
                {
                    ImpactDataset = new RecordReference();
                }

                ImpactDataset.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("MeleeWeaponList", false, out subEle))
            {
                if (MeleeWeaponList == null)
                {
                    MeleeWeaponList = new RecordReference();
                }

                MeleeWeaponList.ReadXML(subEle, master);
            }
        }
Esempio n. 35
0
        public Player(GameState state, Texture2D texture, Vector2 position, int width, int height, bool isControllable = true)
            : base(state, texture, position, width, height, true)
        {
            FacingDirection = 1;

            Energy = MaxEnergy;
            Size   = new Vector2(16, 32);

            Body.Velocity.X = 0;
            Body.Velocity.Y = -2f;

            FloatingUpSpeed   = 0.8f;
            FloatingDownSpeed = FloatingUpSpeed * 2;

            Body.Acceleration.X = 1f;
            Body.MaxVelocity    = 3f;
            Body.Drag.X         = 0.6f;
            Body.Drag.Y         = 0.6f;

            Body.SetSize(10, 26, 11, 3);

            Body.Enabled = true;
            Body.Tag     = "player";

            Health = 4;

            /* Create a few bullets */
            Bullets = new List <Bullet>();
            for (int i = 0; i < 50; i++)
            {
                Bullet b = new Bullet(state, texture, Vector2.Zero, this);
                b.Animations.CurrentFrame = new Frame(0, 78, 16, 16);
                b.Body.SetSize(6, 6, 5, 5);
                b.Body.Drag.Y *= 1.1f;

                Bullets.Add(b);
            }

            movementParticleEmitter = new ParticleEmitter(State, 0, 0, 128);
            movementParticleEmitter.EmitterBox.Resize(1, 24);
            movementParticleEmitter.MakeParticles(texture, 16, 16);
            movementParticleEmitter.ParticleVelocity = new Vector2(0, 0.01f);
            movementParticleEmitter.SetAcceleration(0, -0.005f);                                            ////SEARCH HERE - Pardo////
            movementParticleEmitter.XVelocityVariationRange = new Vector2(-20f, 20f);
            movementParticleEmitter.YVelocityVariationRange = new Vector2(-40f, 40f);
            movementParticleEmitter.SetTextureCropRectangle(new Rectangle(0, 78, 16, 16));
            movementParticleEmitter.SpawnRate = 40f;
            movementParticleEmitter.ParticleLifespanMilliseconds          = 750f;
            movementParticleEmitter.ParticleLifespanVariationMilliseconds = 50f;
            movementParticleEmitter.InitialScale = 0.5f;
            movementParticleEmitter.FinalScale   = 1.1f;

            anchorParticleEmitter = new ParticleEmitter(State, 0, 0, 10);
            //anchorParticleEmitter.EmitterBox.Resize(1, 4);
            anchorParticleEmitter.EmitterBox.Resize(Body.Bounds.Width, Body.Bounds.Height);
            anchorParticleEmitter.MakeRandomParticles(texture, new Rectangle[] { new Rectangle(80, 256, 16, 16), new Rectangle(96, 256, 16, 16) });
            float dispersion = 200f;

            anchorParticleEmitter.XVelocityVariationRange = new Vector2(-dispersion, dispersion);
            anchorParticleEmitter.YVelocityVariationRange = new Vector2(-dispersion, dispersion);
            anchorParticleEmitter.SpawnRate = 150f;
            anchorParticleEmitter.ParticleLifespanMilliseconds          = 750f;
            anchorParticleEmitter.ParticleLifespanVariationMilliseconds = 100f;
            anchorParticleEmitter.InitialScale      = 0.5f;
            anchorParticleEmitter.FinalScale        = 0.1f;
            anchorParticleEmitter.Burst             = true;
            anchorParticleEmitter.ParticlesPerBurst = 5;
            anchorParticleEmitter.Activated         = false;

            Floating = true;

            /*Animations*/

            Animations.CurrentFrame = new Frame(16, 64, 32, 32);

            Animation shootingAnim = Animations.Add("shooting", new Frame[] { new Frame(16, 64, 32, 32), new Frame(288, 64, 32, 32), new Frame(320, 64, 32, 32), new Frame(352, 64, 32, 32)
                                                                              , new Frame(384, 64, 32, 32), new Frame(416, 64, 32, 32) }, 10, false, false);

            Animation idleAnim = Animations.Add("idle", new Frame[] { new Frame(16, 64, 32, 32), new Frame(288, 64, 32, 32), new Frame(320, 64, 32, 32), new Frame(352, 64, 32, 32)
                                                                      , new Frame(384, 64, 32, 32), new Frame(416, 64, 32, 32) }, 14, false, false); //wrong values for now :D

            Animation walkingAnim = Animations.Add("walking", new Frame[] { new Frame(240, 64, 32, 32), new Frame(80, 64, 32, 32), new Frame(112, 64, 32, 32), new Frame(144, 64, 32, 32), new Frame(176, 64, 32, 32),
                                                                            new Frame(208, 64, 32, 32) }, 8, false, false);
        }
Esempio n. 36
0
 // Use this for initialization
 void Start()
 {
     CurrentAnim = Animations.idle;
 }
Esempio n. 37
0
 private void DoRoll()
 {
     StartCoroutine(Actions.Roll(rb, Player_Data.RollAnimationDuration, Player_Data.JumpPower));
     Animations.SetTrigger("Roll", animator);
 }
Esempio n. 38
0
 void KAMAKAZI()
 {
     Animations.AddRange(User.GiveDamage(CreatureElement.FIRE, ActionCategory.PHYSICAL, 255, BasePhysical, BaseMystical, User.GetTotalStat(CreatureStats.ENDURANCE) / 4, User.GetTotalStat(CreatureStats.WISDOM) / 4, 1, User.GetElementEffectiveness(Element)));
     Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ADD_MESSAGE, null, OpponentText(User) + User.ActiveCreature.Nickname + " takes damage from Kamakazi!"));
 }
Esempio n. 39
0
 void SOLIDIFY()
 {
     Animations.Add(Opponent.SetNewElement(CreatureElement.ICE));
     Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ADD_MESSAGE, null, OpponentText(Opponent) + Opponent.ActiveCreature.Nickname + " has been changed to Ice!"));
 }
Esempio n. 40
0
 void DETER()
 {
     User.CanBeMoved.SetFlag(3);
     Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ADD_MESSAGE, null, OpponentText(User) + User.ActiveCreature.Nickname + " cannot be moved for 3 turns!"));
 }
Esempio n. 41
0
 void SLEET_HAMMER()
 {
     Animations.AddRange(Opponent.GiveStatBoost(CreatureStats.AWE, false));
     Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ADD_MESSAGE, null, "The Awe of " + OpponentText(Opponent) + Opponent.ActiveCreature.Nickname + " decreased!"));
 }
Esempio n. 42
0
 void KINDLE()
 {
     Animations.Add(Opponent.GiveCondition((byte)CreatureCondition.BURNED));
     Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ADD_MESSAGE, null, OpponentText(Opponent) + Opponent.ActiveCreature.Nickname + " is Burned!"));
 }
Esempio n. 43
0
 void POLISH()
 {
     Animations.AddRange(User.Heal(20));
     Animations.AddRange(User.GiveStatBoost(CreatureStats.ENDURANCE, true));
     Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ADD_MESSAGE, null, "The Endurance of " + OpponentText(User) + User.ActiveCreature.Nickname + " increased!"));
 }
Esempio n. 44
0
 void CLOBBER()
 {
     Animations.AddRange(Opponent.GiveStatBoost(CreatureStats.ENDURANCE, false));
     Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ADD_MESSAGE, null, OpponentText(Opponent) + Opponent.ActiveCreature.Nickname + " Endurance is lowered!"));
 }
        public EventPageInstance(
            EventBase myEvent,
            EventPage myPage,
            Guid mapId,
            Event eventIndex,
            Player player
            ) : base(Guid.NewGuid())
        {
            BaseEvent      = myEvent;
            Id             = BaseEvent.Id;
            MyPage         = myPage;
            MapId          = mapId;
            X              = eventIndex.X;
            Y              = eventIndex.Y;
            Name           = myEvent.Name;
            MovementType   = MyPage.Movement.Type;
            MovementFreq   = MyPage.Movement.Frequency;
            MovementSpeed  = MyPage.Movement.Speed;
            DisablePreview = MyPage.DisablePreview;
            Trigger        = MyPage.Trigger;
            Passable       = MyPage.Passable;
            HideName       = MyPage.HideName;
            MyEventIndex   = eventIndex;
            MoveRoute      = new EventMoveRoute();
            MoveRoute.CopyFrom(MyPage.Movement.Route);
            mPathFinder = new Pathfinder(this);
            SetMovementSpeed(MyPage.Movement.Speed);
            MyGraphic.Type     = MyPage.Graphic.Type;
            MyGraphic.Filename = MyPage.Graphic.Filename;
            MyGraphic.X        = MyPage.Graphic.X;
            MyGraphic.Y        = MyPage.Graphic.Y;
            MyGraphic.Width    = MyPage.Graphic.Width;
            MyGraphic.Height   = MyPage.Graphic.Height;
            Sprite             = MyPage.Graphic.Filename;
            mDirectionFix      = MyPage.DirectionFix;
            mWalkingAnim       = MyPage.WalkingAnimation;
            mRenderLayer       = MyPage.Layer;
            if (MyGraphic.Type == EventGraphicType.Sprite)
            {
                switch (MyGraphic.Y)
                {
                case 0:
                    Dir = 1;

                    break;

                case 1:
                    Dir = 2;

                    break;

                case 2:
                    Dir = 3;

                    break;

                case 3:
                    Dir = 0;

                    break;
                }
            }

            if (myPage.AnimationId != Guid.Empty)
            {
                Animations.Add(myPage.AnimationId);
            }

            Face     = MyPage.FaceGraphic;
            mPageNum = BaseEvent.Pages.IndexOf(MyPage);
            Player   = player;
            SendToPlayer();
        }
Esempio n. 46
0
 void SPEED_SLASH()
 {
     Animations.Add(Opponent.GiveCondition((byte)CreatureCondition.CUT));
     Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ADD_MESSAGE, null, OpponentText(Opponent) + Opponent.ActiveCreature.Nickname + " is Cut!"));
 }
Esempio n. 47
0
 public void SyncAnimations(string AnimName)
 {
     CurrentAnim = (Animations)Enum.Parse(typeof(Animations), AnimName);
 }
Esempio n. 48
0
 public override void Initialize()
 {
     Animations.Play(this._tile.Pos.Y == 0 ? "sltbr" : "ltbr");
 }
Esempio n. 49
0
 void METAMORPH()
 {
     Animations.AddRange(User.GiveStatBoost(CreatureStats.STRENGTH, true));
     Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ADD_MESSAGE, null, "The Strength of " + OpponentText(User) + User.ActiveCreature.Nickname + " increased!"));
 }
Esempio n. 50
0
        public void UpdateMotion(GameTime gameTime, KeyboardState keyboardState)
        {
            if (Alive)
            {
                base.Update(gameTime);

                if (this.IsControllable && keyboardState != null)
                {
                    float ellapsedTimeMultiplier = (float)gameTime.ElapsedGameTime.TotalSeconds * 1000f;

                    // move left
                    if (keyboardState.IsKeyDown(Keys.A))
                    {
                        this.Body.Velocity.X -= this.Body.Acceleration.X * ellapsedTimeMultiplier;
                        this.FacingDirection  = -1;
                        this.movementParticleEmitter.Activated = true;
                    }
                    // move right
                    if (keyboardState.IsKeyDown(Keys.D))
                    {
                        this.Body.Velocity.X += this.Body.Acceleration.X * ellapsedTimeMultiplier;
                        this.FacingDirection  = 1;
                        this.movementParticleEmitter.Activated = true;
                    }

                    if (keyboardState.IsKeyDown(Keys.Space)) // Basicly trigger
                    {
                        Press = true;
                    }

                    if (Press && keyboardState.IsKeyUp(Keys.Space) && !Floating) //Switch entre estados
                    {
                        Floating = !Floating;
                        Press    = false;
                        //anchorParticleEmitter.Activated = true;
                    }
                    if (Press && keyboardState.IsKeyUp(Keys.Space) && Floating) //Switch entre estados
                    {
                        Floating = !Floating;
                        Press    = false;
                        Energy  -= anchorCost; // mudar para n remover valor quando player vai para cima
                        anchorParticleEmitter.Activated = true;
                        SoundEffect anchor;
                        State.SFX.TryGetValue("anchor", out anchor);
                        anchor?.Play(0.5f, -0.9f, 0f);
                    }

                    Body.Drag.X = 0.6f;

                    /* Floating */

                    if (Floating)
                    {
                        if (Body.Position.Y >= 0)
                        {
                            Body.Velocity.Y -= FloatingUpSpeed; //Floating Up
                        }

                        // bob a bit
                        if (Body.Position.Y <= 0f && !IsBobing)
                        {
                            IsBobing   = true;
                            BobStarted = (float)gameTime.TotalGameTime.TotalMilliseconds;
                            Energy     = MathHelper.Clamp(Energy + MaxEnergy / 2, 0, MaxEnergy);
                        }

                        // recharge
                        if (Energy < MaxEnergy)
                        {
                            Energy += EnergyGain;
                        }
                    }
                    else
                    {
                        IsBobing = false;
                    }

                    if (!Floating)
                    {
                        if ((keyboardState.IsKeyDown(Keys.A) || keyboardState.IsKeyDown(Keys.D)) && Body.CollidingBottom)
                        {
                            Body.Drag.X = 0.068f;
                            Animations.Play("walking");
                        }

                        if (Energy <= 0)
                        {
                            Energy = 0; //impedir que fique com valores negativos
                        }

                        // energy warning sfx
                        if (Energy <= anchorCost) //if the player doesnt have enough energy he hears an error sound
                        {
                            SoundEffect energyWarning;
                            State.SFX.TryGetValue("energyWarning", out energyWarning);
                            energyWarning?.Play(0.5f, 0f, 0f);
                        }

                        if (Energy > anchorCost)
                        {
                            Body.Velocity.Y += FloatingDownSpeed; //Floating Down
                            Energy          -= EnergyDrain;
                        }
                        else
                        {
                            Floating = true;
                        }
                    }

                    // makes the player bob on surface
                    if (IsBobing)
                    {
                        float x = (float)gameTime.TotalGameTime.TotalMilliseconds - BobStarted;

                        float phaseShift = 0.5f * (float)Math.PI;

                        Body.Velocity.Y = Math2.SinWave((x * BobFrequency - phaseShift), BobAmplitude);
                    }
                }

                // apply drag
                Body.Velocity.X *= Body.Drag.X;
                Body.Velocity.Y *= Body.Drag.Y;

                // cap velocity
                Body.Velocity.X = MathHelper.Clamp(Body.Velocity.X, -2f, 2f);
                Body.Velocity.Y = MathHelper.Clamp(Body.Velocity.Y, -4f, 4f);
            }
        }
Esempio n. 51
0
        private static void StatusChangedByBorder(Range range, DependencyPropertyChangedEventArgs e)
        {
            if (range.borderBrush == null)
            {
                range.ApplyTemplate();
            }
            var status = (RangeStatus)e.NewValue;

            if (e.OldValue != null)
            {
                var oldStatus = (RangeStatus)e.OldValue;
                if (IsRepeatAnmimation(status, oldStatus))
                {
                    return;
                }
            }

            switch (status)
            {
            case RangeStatus.Enabled:
            {
                Animations.Opacity(range.borderBrush, SolidColorBrush.OpacityProperty, range.borderBrush.Opacity, range.RawBorderOpacity, 500, EasingMode.EaseOut);
                if (range.ExistInnerBorder)
                {
                    Animations.Opacity(range.innerBorderBrush, SolidColorBrush.OpacityProperty, range.innerBorderBrush.Opacity, range.RawInnerBorderOpacity, 500, EasingMode.EaseOut);
                }

                if (range.FocusBorderThickness != default(Thickness))
                {
                    Animations.Linear(range.border, Border.BorderThicknessProperty,
                                      new Animations.LinearConfig <Thickness>()
                        {
                            DurationMilliseconds = 500,
                            EasingMode           = EasingMode.EaseOut,
                            Start = range.border.BorderThickness,
                            End   = range.RawBorderThickness
                        });
                }
            }
            break;

            case RangeStatus.FixedFocus:
            case RangeStatus.Focus:
            {
                Animations.Opacity(range.borderBrush, SolidColorBrush.OpacityProperty, range.borderBrush.Opacity, range.FocusBorderOpacity, 500, EasingMode.EaseOut);
                if (range.ExistInnerBorder)
                {
                    //获得焦点时,内边框不显示
                    Animations.Opacity(range.innerBorderBrush, SolidColorBrush.OpacityProperty, range.innerBorderBrush.Opacity, 0, 500, EasingMode.EaseOut);
                }

                if (range.FocusBorderThickness != default(Thickness))
                {
                    Animations.Linear(range.border, Border.BorderThicknessProperty,
                                      new Animations.LinearConfig <Thickness>()
                        {
                            DurationMilliseconds = 500,
                            EasingMode           = EasingMode.EaseOut,
                            Start = range.border.BorderThickness,
                            End   = range.FocusBorderThickness
                        });
                }
            }
            break;
            }
        }
Esempio n. 52
0
 void ASTEROIDS()
 {
     Animations.AddRange(Trigger.GiveDamage(CreatureElement.ROCK, ActionCategory.PHYSICAL, 60, BasePhysical, BaseMystical, Trigger.GetTotalStat(CreatureStats.ENDURANCE), Trigger.GetTotalStat(CreatureStats.WISDOM), 1, Trigger.GetElementEffectiveness(Element)));
     Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ADD_MESSAGE, null, OpponentText(Trigger) + Trigger.ActiveCreature.Nickname + " takes damage from Asteroids!"));
 }
Esempio n. 53
0
 public void ConvertToP5()
 {
     Animations.ForEach(a => a.ConvertToP5());
     BlendAnimations.ForEach(ba => ba.ConvertToP5());
 }
Esempio n. 54
0
 void SWITCH()
 {
     Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ADD_MESSAGE, null, OpponentText(User) + User.ActiveCreature.Nickname + " is exiting the arena!"));
     Animations.AddRange(Battle.Switch(User));
     Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ADD_MESSAGE, null, OpponentText(User) + User.ActiveCreature.Nickname + " has taken it's place!"));
 }
Esempio n. 55
0
        void DoShowContentAnimation(Flyout content)
        {
            var dir = DetermineAniDirection(content);

            Animations.SlideIn(_presenter, dir, Animations.TypicalDuration, 200, Animations.TypicalEasing);
        }
Esempio n. 56
0
 void SHARP_MIND()
 {
     Animations.AddRange(User.GiveStatBoost(CreatureStats.WISDOM, true));
     Animations.AddRange(User.GiveStatBoost(CreatureStats.WISDOM, true));
     Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ADD_MESSAGE, null, "The Wisdom of " + OpponentText(User) + User.ActiveCreature.Nickname + " increased!"));
 }
Esempio n. 57
0
        public override bool DrawInternal(SpriteBatch3D spriteBatch, Vector3 position, MouseOverList objectList)
        {
#if !ORIONSORT
            PreDraw(position);
#endif

            if (GameObject.IsDisposed)
            {
                return(false);
            }
            Item item = (Item)GameObject;
#if !ORIONSORT
            spriteBatch.GetZ();
#endif
            byte dir    = (byte)((byte)item.Layer & 0x7F & 7);
            bool mirror = false;
            Animations.GetAnimDirection(ref dir, ref mirror);
            IsFlipped            = mirror;
            Animations.Direction = dir;
            byte animIndex = (byte)GameObject.AnimIndex;

            for (int i = 0; i < LayerOrder.USED_LAYER_COUNT; i++)
            {
                Layer layer = LayerOrder.UsedLayers[dir, i];

                if (layer == Layer.Mount)
                {
                    continue;
                }
                Graphic graphic;
                Hue     color;

                if (layer == Layer.Invalid)
                {
                    graphic = item.DisplayedGraphic;
                    Animations.AnimGroup = Animations.GetDieGroupIndex(item.GetMountAnimation(), item.UsedLayer);
                    color = GameObject.Hue;
                }
                else
                {
                    Item itemEquip = item.Equipment[(int)layer];

                    if (itemEquip == null)
                    {
                        continue;
                    }
                    graphic = itemEquip.ItemData.AnimID;

                    if (Animations.EquipConversions.TryGetValue(itemEquip.Graphic, out Dictionary <ushort, EquipConvData> map))
                    {
                        if (map.TryGetValue(itemEquip.ItemData.AnimID, out EquipConvData data))
                        {
                            graphic = data.Graphic;
                        }
                    }

                    color = itemEquip.Hue;
                }

                Animations.AnimID = graphic;
                ref AnimationDirection direction = ref Animations.DataIndex[Animations.AnimID].Groups[Animations.AnimGroup].Direction[Animations.Direction];

                if (direction.FrameCount == 0 && !Animations.LoadDirectionGroup(ref direction))
                {
                    return(false);
                }
                direction.LastAccessTime = CoreGame.Ticks;
                int fc = direction.FrameCount;
                if (fc > 0 && animIndex >= fc)
                {
                    animIndex = (byte)(fc - 1);
                }

                if (animIndex < direction.FrameCount)
                {
                    TextureAnimationFrame frame = direction.Frames[animIndex];

                    if (frame == null || frame.IsDisposed)
                    {
                        return(false);
                    }
                    int       drawCenterY = frame.CenterY;
                    const int drawX       = -22;
                    int       drawY       = drawCenterY + GameObject.Position.Z * 4 - 22 - 3;
                    int       x           = drawX + frame.CenterX;
                    int       y           = -drawY - (frame.Height + frame.CenterY) + drawCenterY;
                    Texture   = frame;
                    Bounds    = new Rectangle(x, -y, frame.Width, frame.Height);
                    HueVector = RenderExtentions.GetHueVector(color);
                    base.Draw(spriteBatch, position, objectList);
                    Pick(frame.ID, Bounds, position, objectList);
                }
            }
Esempio n. 58
0
        public void UpdateProjectiles(GameTime gameTime, KeyboardState keyboardState)
        {
            if (Alive)
            {
                this.movementParticleEmitter.Update(gameTime);
                this.movementParticleEmitter.ForEachParticle(KillOutOfBoundsParticle);
                this.movementParticleEmitter.EmitterBox.X = Body.X + 11;
                this.movementParticleEmitter.EmitterBox.Y = Body.Y + 3;
                this.movementParticleEmitter.Activated    = false;

                this.anchorParticleEmitter.Update(gameTime);
                this.anchorParticleEmitter.EmitterBox.X = Body.X + 8;
                this.anchorParticleEmitter.EmitterBox.Y = Body.Y + 16;
                this.anchorParticleEmitter.Activated    = false;
            }

            if ((keyboardState.IsKeyDown(Keys.RightControl) || keyboardState.IsKeyDown(Keys.LeftControl)) && Energy >= BulletCost)
            {
                Animations.Play("shooting");
                if (this.LastShot < gameTime.TotalGameTime.TotalMilliseconds)
                {
                    this.LastShot = (float)gameTime.TotalGameTime.TotalMilliseconds + this.ShootRate;

                    // get the first dead bullet
                    Bullet b = null;
                    for (int i = 0; i < Bullets.Count; i++)
                    {
                        if (!Bullets[i].Alive)
                        {
                            b = Bullets[i];
                            break;
                        }
                    }

                    if (b != null)
                    {
                        Random rnd        = new Random();
                        int    YVariation = 4;

                        b.Reset();
                        b.Revive();

                        b.ShotAtMilliseconds = gameTime.TotalGameTime.TotalMilliseconds;

                        b.Body.X = Body.X + (FacingDirection > 0 ? 24 : -2);
                        b.Body.Y = this.Body.Y + rnd.Next(-YVariation, YVariation) + 10;                     //TODO: fix 16 offset with final sprites

                        b.Body.Velocity.X = (ShootingVelocity + (rnd.Next(-2, 2) * 0.1f)) * FacingDirection; // some variation to the speed
                        b.Body.Velocity.Y = (rnd.Next(-3, -1) * 0.01f);                                      // make it float a bit

                        // subtract bullet cost to energy
                        Energy -= BulletCost;
                        FireKnockBack(this);
                        Karma.AddShotFired();

                        float pitch = rnd.Next(-100, 10) * 0.01f;

                        SoundEffect sfx;
                        State.SFX.TryGetValue("bubble", out sfx);
                        sfx?.Play(1f, pitch, 0f);
                    }
                }
            }

            foreach (Bullet b in Bullets)
            {
                b.Update(gameTime);
            }
        }
Esempio n. 59
0
 void CEASEFIRE()
 {
     User.CanBeAttacked.SetFlag(2);
     Opponent.CanBeAttacked.SetFlag(2);
     Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ADD_MESSAGE, null, "Neither Player can directly attack the other next turn!"));
 }
Esempio n. 60
0
 void SMOULDER_SMASH()
 {
     Animations.Add(Opponent.GiveCondition((byte)CreatureCondition.BLIND));
     Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ADD_MESSAGE, null, OpponentText(Opponent) + Opponent.ActiveCreature.Nickname + " is Blind!"));
 }