示例#1
0
    public void CheckReactions(actionData act)
    {
        foreach (reaction el in reactsOnStack)
        {
            Debug.Log("check react");
            //overwatch is temporary
            if (el.actor.inOverwatch == false && el.action == 1)
            {
            }
            else
            {
                //confirm the action matches the reaction event
                if (act.reactType == el.reacttype && Vector3.Distance(el.actor.transform.position, act.loc) < el.range && el.actor.currentreactPoints >= el.cost)
                {
                    //confirm the target is the correct team
                    if (((act.team == el.actor.team && el.teamtype == 0) || (act.team != el.actor.team && el.teamtype == 1)) && el.actor != act.actor)
                    {
                        Debug.Log(" confirmed react");
                        actionsOnStack.Add(actionManager.ConfirmAction(el.action, el.actor, act.target, this.GetComponent <TurnManager>()));


                        el.actor.usedReaction        = true;
                        el.actor.currentreactPoints -= el.cost;
                        if (el.actor.inOverwatch == true && el.action == 1)
                        {
                            el.actor.inOverwatch = false;
                        }
                    }
                }
            }
        }
        if (actionsOnStack.Count > 1)
        {
            cam.active      = false;
            reactCam.active = true;
        }
        reacting = true;
    }