예제 #1
0
        private void SpawnMoveSprite(UIHex origin, UIHex direction)
        {
            var sprite = Instantiate(movePrefab, origin.transform);

            Quaternion rotation = Quaternion.LookRotation(Vector3.forward, direction.transform.position - sprite.transform.position);

            sprite.transform.rotation = rotation;

            Destroy(sprite, 0.25f);
        }
예제 #2
0
        private void SpawnAttackSprite(UIHex attacker, UIHex defender)
        {
            var sprite = Instantiate(attackPrefab, attacker.transform);

            var position = new Vector3();

            position.x = attacker.transform.position.x + (defender.transform.position.x - attacker.transform.position.x) / 2;
            position.y = attacker.transform.position.y + (defender.transform.position.y - attacker.transform.position.y) / 2;

            sprite.transform.position = position;

            Destroy(sprite, 0.25f);
        }