コード例 #1
0
    /*
     * private List<GameObject> GOs;
     * void OnTriggerEnter(Collider Other)
     * {
     *  GOs.Add(Other.gameObject);
     * }*/
    public void AttackAct()
    { // invoke on button
        CollisionObjects ColObj      = this.gameObject.transform.GetChild(1).GetComponent <CollisionObjects>();
        List <CharStats> targetStats = new List <CharStats>();

        if (ColObj != null)
        {
            foreach (GameObject item in ColObj.items)
            {
                if (item == null)
                {
                    ColObj.items.Remove(item);
                    continue;
                }
                targetStats.Add(item.GetComponent <CharStats>());
                //if (targetStats != null)
            }
            Debug.Log("Number of CharStats: " + targetStats.Count);

            combat.MultiAttack(targetStats);
        }
    }