コード例 #1
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
コード例 #2
0
    private void Awake()
    {
        // Make the object a singleton
        if (_instance != null && _instance != this)
        {
            Destroy(this.gameObject);
        }
        else
        {
            _instance = this;
        }

        // Create the api reference
        api = new SmtApiCaller();
    }
コード例 #3
0
    public void commenceAttack(Task attackWork)
    {
        // Debug.Log("cohort attacking " + getIt.name);
        masterTask = attackWork;
        if (armedMembers.Count > 0)
        {
            Stop();
            foreach (Unit_local member in members)
            {
                if (member.stats.isArmed == false)
                {
                    member.changeCohort();
                    member.deactivate();
                }
            }
            if (attackWork.dataA == 0)
            {
// ProcessTargetingCandidate isn't necessary because that logic is implicit in the InputHandler's response to single unit being clicked on.
                remainingToPerish.Add(attackWork.objectUnit);
                attackWork.objectUnit.cohortsAttackingThisUnit.Add(this);
            }
            else
            {
                Collider2D [] inTargetArea = Physics2D.OverlapCircleAll(attackWork.center, attackWork.dataA);
                foreach (Collider2D contact in inTargetArea)
                {
                    ProcessTargetingCandidate(contact.gameObject);
                }
                GameObject newSensor = (GameObject)GameObject.Instantiate(Resources.Load("Sensor"), attackWork.center, Quaternion.identity);
                areaAttackSensor = newSensor.GetComponent <SensorBridge>();
                areaAttackSensor.Setup(this, attackWork.dataA);
            }
            foreach (Unit_local attacker in members)
            {
                if (remainingToPerish.Count <= 0)
                {
                    break;
                }
                assignViolentWork(attacker);
            }
        }
    }
コード例 #4
0
 // Use this for initialization
 void Start()
 {
     sensorBridge = SensorBridge.Instance;
 }