コード例 #1
0
    private void GenerateCursor(CommonBattleChara target)
    {
        if (instance.nowSelectedCharactor != null)
        {
            Destroy(instance.nowSelectedCharactor);
        }

        foreach (Transform obj in GameObject.Find(basePositionsPath).GetComponent <Transform>())
        {
            int     index = obj.transform.GetSiblingIndex();
            Vector2 pos   = new Vector2(index / COUNT_BASE_POS % COUNT_BASE_POS, index % COUNT_BASE_POS);
            if (target.ConvertObjectToVector(target.gameObject) == pos)
            {
                instance.nowSelectedCharactor = Instantiate(Resources.Load("TargetCursolEffect"), new Vector3(-100, -100, 0), Quaternion.identity) as GameObject;
                instance.nowSelectedCharactor.transform.SetParent(basePositions[index / COUNT_BASE_POS % COUNT_BASE_POS, index % COUNT_BASE_POS].transform);
            }
        }
    }
コード例 #2
0
    public void OnMoveDown()
    {
        CommonBattleChara tmp = null;

        switch (GetWhoseTurn())
        {
        case WhoseTurn.player:
            tmp = instance.player.GetComponent <BattlePlayer>();
            break;

        case WhoseTurn.braver:
            tmp = instance.braver.GetComponent <BattleBraver>();
            break;

        case WhoseTurn.princess:
            tmp = instance.princess.GetComponent <BattlePrincess>();
            break;
        }

        tmp.OnMoveDown();
    }