コード例 #1
0
    void UpdateLemmingTargets(Transform bait)
    {
        if (lemmings == null)
        {
            lemmings = FindObjectsOfType <LemmingController>();
        }


        for (int i = 0; i < lemmings.Length; i++)
        {
            if (i == 0)
            {
                lemmings[i].UpdateAgentTarget(lemmings[lemmings.Length - 1].transform);
            }
            else
            {
                lemmings[i].UpdateAgentTarget(lemmings[i - 1].transform);
            }
        }


        LemmingController lc = ClosestLemming(lemmings, bait);

        lc.UpdateAgentTarget(bait);
    }
コード例 #2
0
    void PlaceLemming(GameObject lemming)
    {
        if (Input.GetButtonDown("Fire1"))
        {
            LemmingController lController = lemming.GetComponent <LemmingController>();

            gameController.RemoveFromSpawn(lController.GetSpawnIndex());

            lemming.transform.parent   = transform;
            lemming.transform.position = new Vector3(7.0f, 0.1f, lane.transform.position.z);

            lController.StartRunning();
            lController.Deselect();

            lane.SetActive(false);
        }
    }
コード例 #3
0
    LemmingController ClosestLemming(LemmingController[] lemmings, Transform bait)
    {
        LemmingController closestLemming = lemmings[0];

        float distance = 1000000;

        foreach (LemmingController l in lemmings)
        {
            float d = Vector3.Distance(l.transform.position, bait.position);
            if (d < distance)
            {
                distance       = d;
                closestLemming = l;
            }
        }


        return(closestLemming);
    }
コード例 #4
0
ファイル: PlayerHandler.cs プロジェクト: smokelore/StarRush
 // Use this for initialization
 void Start()
 {
     GestureHandler = this.GetComponent<GestureHandler>();
     BuildController = this.GetComponent<build>();
     LemmingController = this.GetComponent<LemmingController>();
     this.networkView.group = this.PLAYER_NUM;	// Player-specific messages only sent to this player's group
 }