Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        SelectObjects();

        if (Input.GetKeyUp(KeyCode.Space) && player_selected != null)
        {
            cam.MoveCameraTo(player_selected.transform.position);
        }

        if (object_selected == null) //No object is currently selected
        {
            //Shortcuts selection (high priority over mouse selection) TODO:change keycode for editable input
            if (Input.GetKeyUp(KeyCode.Alpha1)) //Barion
            {
                player_selected = barion;
                return;
            }

            if (Input.GetKeyUp(KeyCode.Alpha2)) //Cosmo
            {
                player_selected = cosmo;
                return;
            }

            if (Input.GetKeyUp(KeyCode.Alpha3)) //Nyx
            {
                player_selected = nyx;
                return;
            }

            UpdatePlayerSelection();
        }
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        checkpoint_manager.InitializeCheckpoints(start_point); //Get the checkpoint to spawn in the right position

        // The different players is distributed equidistantly on a circle of radius "radius". The script automatically take into account
        // the number of players to put along the circle.
        float angle      = 0.0f;
        float incr_angle = ((2 * Mathf.PI) / players.Length);

        foreach (GameObject p in players)
        {
            p.GetComponent <NavMeshAgent>().Warp(new Vector3(radius * Mathf.Cos(angle) + start_point.position.x, 0, radius * Mathf.Sin(angle) + start_point.position.z));
            angle += incr_angle;
        }

        cam.MoveCameraTo(start_point.position); //Center camera to start point;
    }
Esempio n. 3
0
    /// <summary>
    /// CheckVisibleTargets() checks every Transform gameObject returned by FindVisibleTargets() and checks its Tag.
    /// If player is found, the level resets. If an enemy corpse is found, alert mode is activated.
    /// </summary>
    public void CheckVisibleTargets()
    {
        if (enemy_manager.god_mode == true) //Don't check visible characters if god mode is activated.
        {
            return;
        }

        foreach (Transform t in visible_targets)
        {
            // Response for players!
            if (t.tag.Equals(Tags.player))
            {
                if (t.GetComponent <Invisible>().IsInvisible())
                {
                    continue;
                }
                if (!player_found)
                {
                    player_found = true;
                    main_camera.MoveCameraTo(transform.position);
                    screen_fader.EndScene(0);

                    // Debug part
                    //---------------------------
                    // Tint yellow the enemy who discovered a character
                    GetComponent <MeshRenderer>().material.SetColor("_Color", new Color(1.0f, 1.0f, 0.0f, 0.0f));
                    //---------------------------
                }
            }

            if (!enemy_manager.IsElementAlreadyIdentify(t.gameObject))
            {
                // Response: If something is found, the enemy will move
                // to a near position to cleary identify that element
                if ((t.tag.Equals(Tags.corpse) || t.tag.Equals(Tags.portal)) && !IsElementIdentificationPending(t.gameObject))
                {
                    pending_identification_elements.Enqueue(t.gameObject);
                    RhandorController rhandor = GetComponent <RhandorController>();
                    last_spotted_position.LastPosition = t.transform.position;
                    rhandor.ChangeStateTo(rhandor.spotted_state);
                }
            }
        }
    }