コード例 #1
0
    void Awake()
    {
        // State machine
        // -- IDLE --
        idle_state = new CameraIdleState(this);
        // -- ALERT --
        alert_state = new CameraAlertState(this);
        // -- FOLLOWING --
        following_state = new CameraFollowingState(this);

        foreach (Transform childs in transform.getChilds())
        {
            if (childs.gameObject.name == "camera_lens")
            {
                camera_lens = childs;
            }
        }

        initial_forward_direction = camera_lens.transform.forward;
        initial_rotation          = camera_lens.rotation;

        alarm_system          = GameObject.FindGameObjectWithTag(Tags.game_controller).GetComponent <AlarmSystem>();
        last_spotted_position = GameObject.FindGameObjectWithTag(Tags.game_controller).GetComponent <LastSpottedPosition>();
        players = GameObject.FindGameObjectsWithTag(Tags.player);

        // Camera sweep
        mid_angle     = angle_range / 2.0f;
        current_speed = max_rotation_speed;
        left_zone     = zone_for_acceleration * angle_range;
        right_zone    = angle_range - (zone_for_acceleration * angle_range);
    }
コード例 #2
0
 // Awake
 void Awake()
 {
     alarm_system          = GameObject.FindGameObjectWithTag(Tags.game_controller).GetComponent <AlarmSystem>();
     screen_fader          = GameObject.FindGameObjectWithTag(Tags.screen_fader).GetComponent <ScreenFader>();
     enemy_manager         = GetComponentInParent <EnemyManager>();
     main_camera           = GameObject.FindGameObjectWithTag(Tags.main_camera).GetComponent <CameraMove>();
     last_spotted_position = GameObject.FindGameObjectWithTag(Tags.game_controller).GetComponent <LastSpottedPosition>();
 }
コード例 #3
0
    void Awake()
    {
        // State machine
        // -- IDLE --
        idle_state = new RhandorIdleState(this);
        // -- PATROL --
        patrol_state = new RhandorPatrolState(this);
        LoadNeutralPatrol();
        // -- ALERT --
        alert_state = new RhandorAlertState(this);
        LoadAlertPatrol();
        // -- SPOTTED --
        spotted_state = new RhandorSpottedState(this);
        // -- SPOTTED --
        support_state = new RhandorSupportState(this);
        // -- CORPSE --
        corpse_state = new RhandorCorpseState(this);

        if (neutral_patrol.is_synchronized)
        {
            LoadSynchronousConfiguration(neutral_patrol);
        }

        if (alert_patrol.is_synchronized)
        {
            LoadSynchronousConfiguration(alert_patrol);
        }

        if (neutral_patrol.path_attached == alert_patrol.path_attached)
        {
            same_neutral_alert_path = true;
        }

        render = GetComponent <SpriteRenderer>();
        type   = ENEMY_TYPES.RHANDOR;

        initial_forward_direction = transform.forward;
        time_recovering_timer     = max_time_recovering = 2.0f;

        alarm_system          = GameObject.FindGameObjectWithTag(Tags.game_controller).GetComponent <AlarmSystem>();
        last_spotted_position = GameObject.FindGameObjectWithTag(Tags.game_controller).GetComponent <LastSpottedPosition>();
        enemy_field_view      = GetComponent <EnemyFieldView>();
        enemy_manager         = GetComponentInParent <EnemyManager>(); //Every enemy should be child of the enemy manager
        agent = GetComponent <NavMeshAgent>();                         // Agent for NavMesh

        //Insert all menus in the dictionary
        RadialMenu_ObjectInteractable[] menus_scripts = GetComponents <RadialMenu_ObjectInteractable>();
        foreach (RadialMenu_ObjectInteractable menu_script in menus_scripts)
        {
            menus.Add(menu_script.id, menu_script);
        }
    }