コード例 #1
0
 public AttackCalculation(Transform attacker)
 {
     Attacker = attacker;
     CriticalHit = false;
     attackerProperty = Attacker.GetComponent<CharacterProperty>();
     attackerSelect = Attacker.GetComponent<CharacterSelect>();
     attackerLocation = attackerSelect.getMapPosition();
     sUI = Camera.mainCamera.GetComponent<DamageSlidingUI>();
 }
コード例 #2
0
ファイル: AttackCalculation.cs プロジェクト: qipa/BattleCard
 public AttackCalculation(Transform attacker)
 {
     Attacker         = attacker;
     CriticalHit      = false;
     attackerProperty = Attacker.GetComponent <CharacterProperty>();
     attackerSelect   = Attacker.GetComponent <CharacterSelect>();
     attackerLocation = attackerSelect.getMapPosition();
     sUI = Camera.mainCamera.GetComponent <DamageSlidingUI>();
 }
コード例 #3
0
        void CalBuffUsage()
        {
            BuffUsage    bUsage       = BuffUsage.None;
            int          locationSide = 0;
            Transform    location     = selection.getMapPosition();
            RoundCounter rnd          = Camera.mainCamera.GetComponent <RoundCounter>();

            if (rnd.PlayerATerritory.Contains(location))
            {
                locationSide = 1;
            }
            else if (rnd.PlayerBTerritory.Contains(location))
            {
                locationSide = 2;
            }
            else
            {
                locationSide = 0;
            }

            if (playerSide == 1)
            {
                switch (locationSide)
                {
                case (1):
                    bUsage = BuffUsage.Intensify;
                    break;

                case (2):
                    bUsage = BuffUsage.Decrease;
                    break;

                case (0):
                    bUsage = BuffUsage.None;
                    break;
                }
            }
            else if (playerSide == 2)
            {
                switch (locationSide)
                {
                case (1):
                    bUsage = BuffUsage.Decrease;
                    break;

                case (2):
                    bUsage = BuffUsage.Intensify;
                    break;

                case (0):
                    bUsage = BuffUsage.None;
                    break;
                }
            }
            usage = bUsage;
        }
コード例 #4
0
 public void SetAttackSequence(Transform attacker, Transform targetMap)
 {
     Attacker         = attacker;
     CriticalHit      = false;
     attackerProperty = Attacker.GetComponent <CharacterProperty>();
     attackerSelect   = Attacker.GetComponent <CharacterSelect>();
     attackerLocation = attackerSelect.getMapPosition();
     targetLocation   = targetMap;
     Target           = MapHelper.GetMapOccupiedObj(targetLocation);
     targetProperty   = Target.GetComponent <CharacterProperty>();
     targetSelect     = Target.GetComponent <CharacterSelect>();
     oldRotation      = Attacker.transform.rotation;
     //mUI.MainGuiFade = false;
     //mUI.SubGuiFade = true;
     turnedHead = true;
 }
コード例 #5
0
ファイル: DeathUI.cs プロジェクト: Darkfeast/BattleCard
    public DeathUI(Transform chess, Transform attacker)
    {
        Chess    = chess;
        Attacker = attacker;
        CommonFX        cFX     = Camera.mainCamera.GetComponent <CommonFX>();
        CharacterSelect cSelect = Chess.GetComponent <CharacterSelect>();
        Transform       map     = cSelect.getMapPosition();

        FxPos = new Vector3(map.transform.position.x, map.transform.position.y + 0.1f, map.transform.position.z);
        Transform fx  = Object.Instantiate(cFX.DeadOut, FxPos, Quaternion.identity) as Transform;
        Color     col = Chess.renderer.material.color;

        MapHelper.SetObjTransparent(Chess, col, 1.0f);
        Object.Destroy(GameObject.Find(fx.name).gameObject, 3.0f);
        Chess.GetComponent <CharacterPassive>().StartDie = true;
        //Debug.Log("EatShit");
    }
コード例 #6
0
    public void SetAttackSequence(Transform attacker, Transform targetMap)
    {
        Attacker = attacker;
        //CriticalHit = false;
        attackerProperty = Attacker.GetComponent <CharacterProperty>();
        attackerSelect   = Attacker.GetComponent <CharacterSelect>();
        attackerLocation = attackerSelect.getMapPosition();
        targetLocation   = targetMap;
        Target           = MapHelper.GetMapOccupiedObj(targetLocation);
        targetProperty   = Target.GetComponent <CharacterProperty>();
        targetSelect     = Target.GetComponent <CharacterSelect>();

        UpdateAttackResult(AttackType.physical);
        Vector3   pos   = new Vector3(Target.transform.position.x, Target.transform.position.y, Target.transform.position.z);
        Transform blood = Instantiate(cFX.NormalAttack, pos, Quaternion.identity) as Transform;

        Destroy(GameObject.Find(blood.name).gameObject, 3.0f);
        mUI.MainGuiFade = true;
        mUI.SubGuiFade  = false;
    }
コード例 #7
0
    bool MoveCommand(Transform chess)
    {
        bool              moveable      = false;
        CharacterSelect   chessSelect   = chess.GetComponent <CharacterSelect>();
        CharacterProperty chessProperty = chess.GetComponent <CharacterProperty>();
        Transform         localUnit     = chessSelect.getMapPosition();
        IList             pathList      = new List <Transform>();
        Transform         sel           = decisions.GetMoveTarget(chess);

        if (sel != null)
        {
            pathList = chessSelect.FindPathList(localUnit, CurrentSel.GetSteps(localUnit, sel), sel);
            MoveCharacter mc = Camera.main.GetComponent <MoveCharacter>();
            mc.SetSteps(chess, pathList);
            chessProperty.Moved = true;
            moveable            = true;
        }
        else
        {
            moveable = false;
        }
        return(moveable);
    }
コード例 #8
0
    public Transform GetMoveTarget(Transform chess)
    {
        IList           mapList       = new List <Transform>();
        IList           selfTerritory = new List <Transform>();
        IList           closeList     = new List <Transform>();
        Transform       targetMap     = null;
        CharacterSelect chessSel      = chess.GetComponent <CharacterSelect>();

        currentSelect.updateMapSteps();
        Transform currentPos = chessSel.getMapPosition();

        chessSel.findMoveRange(currentPos, 0, chess.GetComponent <CharacterProperty>().BuffMoveRange);
        foreach (Transform map in chessSel.MoveRangeList)
        {
            if (!MapHelper.IsMapOccupied(map))
            {
                mapList.Add(map);
            }
        }
        chessSel.MoveRangeList.Clear();

        foreach (Transform map in currentRC.PlayerBTerritory)
        {
            if (!MapHelper.IsMapOccupied(map))
            {
                selfTerritory.Add(map);
            }
        }

        Transform closestOne = Camera.main.GetComponent <MoveCharacter>().GetClosetChess(chess);

        closeList = MapHelper.GetClosestMaps(closestOne, mapList);
        //print("The Closest One: "+closestOne);
        if (closeList.Count == 1)
        {
            targetMap = closeList[0] as Transform;
        }
        else if (closeList.Count > 1)
        {
            Transform[] pPos = new Transform[selfTerritory.Count];
            selfTerritory.CopyTo(pPos, 0);
            Transform[] closestPos = new Transform[closeList.Count];
            closeList.CopyTo(closestPos, 0);
            IEnumerable <Transform> bothPos   = pPos.Intersect(closestPos);
            Transform[]             bothArray = bothPos.ToArray();
            if (bothArray.Length == 1)
            {
                targetMap = bothArray[0] as Transform;
            }
            else if (bothArray.Length > 1)
            {
                int rnd = Random.Range(0, bothArray.Length - 1);
                targetMap = bothArray[rnd] as Transform;
            }
            else if (bothArray.Length == 0)
            {
                int rnd = Random.Range(0, closeList.Count - 1);
                targetMap = closeList[rnd] as Transform;
            }
        }

        return(targetMap);
    }
コード例 #9
0
    public void SetAttackSequence(Transform attacker, Transform targetMap)
    {
        Attacker = attacker;
        //CriticalHit = false;
        attackerProperty = Attacker.GetComponent<CharacterProperty>();
        attackerSelect = Attacker.GetComponent<CharacterSelect>();
        attackerLocation = attackerSelect.getMapPosition();
        targetLocation = targetMap;
        Target = MapHelper.GetMapOccupiedObj(targetLocation);
        targetProperty = Target.GetComponent<CharacterProperty>();
        targetSelect = Target.GetComponent<CharacterSelect>();

        UpdateAttackResult(AttackType.physical);
        Vector3 pos = new Vector3(Target.transform.position.x,Target.transform.position.y,Target.transform.position.z);
        Transform blood = Instantiate(cFX.NormalAttack,pos,Quaternion.identity) as Transform;
        Destroy(GameObject.Find(blood.name).gameObject,3.0f);
        mUI.MainGuiFade = true;
        mUI.SubGuiFade = false;
    }