コード例 #1
0
 public bool checkForDuplicateActionMarker(ActionMarkerGO marker)
 {
     for (int i = 0; i < actionMarkers.Count; i++)
     {
         if (actionMarkers [i].IsActive)
         {
             if (actionMarkers [i].Owner == marker.Owner && actionMarkers[i].IDNum == marker.IDNum && actionMarkers [i] != marker)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        //kill this if the owner is not active or uses the action
        if (!owner.IsActive || owner.ActionsLeft < idNum)
        {
            StartCoroutine(doScaleAnim(0, growTime, true));
        }

        //spawn another if the owner has more actions!
        if (owner.ActionsLeft > idNum && child == null)
        {
            child = GameObjectManager.instance.getActionMarkerGO();
            child.activate(owner, idNum + 1);
        }

        //should we be demoing action cost for a card?
        if (!doingAnimation)
        {
            int curCost = 0;
            foreach (Card card in owner.deck.Hand)
            {
                if (card.mouseIsOver)
                {
                    curCost = card.getNumActionsNeededToPlay();
                }
            }
            int totalActions = owner.ActionsLeft;

            bool shouldDemoCost = curCost > (totalActions - idNum);
            if (shouldDemoCost != isDemoingActionCost)
            {
                isDemoingActionCost = shouldDemoCost;
                float newScale = isDemoingActionCost ? smallScale : 1;
                StartCoroutine(doScaleAnim(newScale, growTime, false));
            }
        }

        //and if the action go used, clear the child
        if (child != null)
        {
            if (!child.isActive)
            {
                child = null;
            }
        }

        spriteRend.enabled  = owner.getIsVisibleToPlayer() || GameManagerTacticsInterface.instance.intoTheBreachMode;
        labelSprite.enabled = (owner.getIsVisibleToPlayer() || GameManagerTacticsInterface.instance.intoTheBreachMode) && idNum == 1;
    }
コード例 #3
0
    public ActionMarkerGO getActionMarkerGO()
    {
        //check if we have any inactive in the list
        for (int i = 0; i < actionMarkers.Count; i++)
        {
            if (actionMarkers [i].IsActive == false)
            {
                return(actionMarkers [i]);
            }
        }

        //otherwise make one
        GameObject     obj = Instantiate(actionMarkerPrefab) as GameObject;
        ActionMarkerGO GO  = obj.GetComponent <ActionMarkerGO> ();

        actionMarkers.Add(GO);
        return(GO);
    }
コード例 #4
0
    public void activate(Unit unit, int _idNum)
    {
        isActive = true;
        owner    = unit;
        idNum    = _idNum;
        //check if this is redundant
        if (GameObjectManager.instance.checkForDuplicateActionMarker(this) == true)
        {
            deactivate();
            return;
        }
        //or if they don't have the current number of needed actions
        if (owner.ActionsLeft < idNum)
        {
            deactivate();
            return;
        }

//		if (spriteRend == null) {
//			spriteRend = GetComponent<SpriteRenderer> ();
//		}

        gameObject.SetActive(true);

        child = null;

        if (needsStartPos)
        {
            needsStartPos  = false;
            startPosPlayer = GameObject.Find("actionMarker_player_startPos").transform;
            startPosAI     = GameObject.Find("actionMarker_ai_startPos").transform;
        }

        startPos = owner.isPlayerControlled ? startPosPlayer : startPosAI;

        gameObject.name = "action_marker " + unit.unitName;

        transform.position = startPos.position + new Vector3(xSpacing * (idNum - 1), 0, 0);

        isDemoingActionCost = false;

        StartCoroutine(doScaleAnim(1, growTime, false));
    }