Esempio n. 1
0
    //public float moveSpeed = 25.0f;

    // Use this for initialization
    void Awake()
    {
        trackingScript = this;

        netView = GetComponent <NetworkView>();

        AddDino += DinoToAdd;

        posText = new GameObject();
        posText.AddComponent <GUIText>();
        posText.guiText.pixelOffset = new Vector2(Screen.width / 2, Screen.height - 20);

        lapText = new GameObject();
        lapText.AddComponent <GUIText>();
        lapText.guiText.pixelOffset = new Vector2(Screen.width / 2, Screen.height - 40);

        totalDist = new float[4];

        finishDist = new float[4];

        lapCount = new int[4];

        dinos = new GameObject[4];

        /*playerDinos = new GameObject[4];
         *
         * cpuDinos = new GameObject[4];*/

        currentNodes = new NodeBehavior[4];

        nextNodes = new NodeBehavior[4];

        currentPositions = new int[4];

        //menu = GameObject.FindGameObjectWithTag("Menu");

        //menuScript = menu.GetComponent<MenuControl>();

        tempDinos = new GameObject[4];
        //private int tempDinoIndex;

        for (int i = 0; i < currentNodes.Length; i++)
        {
            currentNodes[i] = startNode.GetComponent <NodeBehavior>();
            nextNodes[i]    = currentNodes[i].NextNodes[0].GetComponent <NodeBehavior>();

            finishDist[i] = AddUpDistance(currentNodes[i].GetComponent <NodeBehavior>(), nextNodes[i].GetComponent <NodeBehavior>(), 0);
        }


        //finishDist[0] = AddUpDistance(currentNodes[0].GetComponent<NodeBehavior>(), nextNodes[0].GetComponent<NodeBehavior>(), 0);


        for (int i = 0; i < currentPositions.Length; i++)
        {
            currentPositions[i] = i + 1;
            //Debug.Log("The start pos " + currentPositions[i]);
        }
    }
Esempio n. 2
0
 // Use this for initialization
 void Start()
 {
     try
     {
         dTrack = transform.parent.gameObject.GetComponent <DinoTracking>();
     }
     catch (UnityException e)
     {
         Debug.Log(e.Message);
         this.enabled = false;
     }
 }
Esempio n. 3
0
    //---------------------------//



    // Use this for initialization
    void Start()
    {
        if (networkView.isMine)
        {
            mc     = GetComponent <MotionControl> ();
            inv    = GetComponent <Inventory> ();
            melee  = GetComponent <MeleeAttack> ();
            bomb   = GetComponent <Bomb> ();
            health = GetComponent <Health> ();

            current = GameObject.Find(FirstNavNode).GetComponent <RespawnNode> ();
            current = current.nextNodes [0];

            Debug.Log("AI Current Target: " + current.name);
            dinoTracking = GameObject.Find("Checkpoints").GetComponent <DinoTracking>();
            StartCoroutine(AITick());
        }
    }
Esempio n. 4
0
    // Use this for initialization
    void Start()
    {
        /*if(this.tag == "Dino")
         * {
         *      int playerNum;
         *
         *      int.TryParse(Network.player.ToString(), out playerNum);
         *
         *      DinoTracking.AddDino(this.gameObject, playerNum);
         *
         * }
         * else if(this.tag == "Ai" && Network.isServer == true)
         *      DinoTracking.AddDino(this.gameObject, -1);*/

        if (this.tag == "Dino" || this.tag == "Ai")
        {
            DinoTracking.AddDino(this.gameObject);
        }
    }
    public override void Fire()
    {
        return;

        Debug.Log("Mad Dash!");
        WeaponVFX.enableEmission = true;
        WeaponVFX.Play();
        dinoTracking = GameObject.Find("Checkpoints").GetComponent <DinoTracking>();
        int[] positions      = dinoTracking.GetCurrentPositions();
        int   playerNum      = dinoTracking.playerNum;
        int   playerPosition = positions[playerNum];

        //if player in first position, move them to second
        if (playerPosition == 1)
        {
            SwitchPositions(playerNum, Array.IndexOf(positions, 2));
        }
        else
        {
            SwitchPositions(playerNum, Array.IndexOf(positions, playerPosition - 1));
        }
    }