コード例 #1
0
ファイル: UIBoard.cs プロジェクト: nhayes1031/AutoChess
        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
ファイル: UIBoard.cs プロジェクト: nhayes1031/AutoChess
        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);
        }