Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        manager_data = manager.UpdateSplashController();

        if (manager_data == null)
        {
            return;
        }

        y_level      = manager_data.water_level;
        is_in_water  = manager_data.is_in_water;
        is_submerged = manager_data.is_submerged;

        timer += (Time.deltaTime * TIMER_MULTIPLIER);

        if (timer >= SPAWN_INTERVAL)
        {
            timer = 0.0f;



            if (!is_in_water)
            {
                return;
            }

            if (is_submerged)
            {
                return;
            }

            spawn_vector.x = this.transform.position.x;
            spawn_vector.y = y_level;
            spawn_vector.z = this.transform.position.z;

            spawned_splash_prefab = Instantiate(splash_prefab, spawn_vector, Quaternion.identity);
            spawned_splash_prefab.transform.localScale = Vector3.zero;
            spawned_splash_prefab.GetComponent <ActorFxSplashController>().scale_multiplier = splash_scale_multiplier;
        }
    }
Ejemplo n.º 2
0
    private void Start()
    {
        master = GameMasterController.GetMasterController();

        // initialise state controllers.

        state_default       = new PlayerStateDefaultController();
        state_jump          = new PlayerStateJumpController();
        state_water_default = new PlayerStateWaterDefaultController();
        state_water_jump    = new PlayerStateWaterJumpController();
        state_slide         = new PlayerStateSlideController();
        state_dive          = new PlayerStateDiveController();
        state_water_dive    = new PlayerStateWaterDiveController();
        state_attack        = new PlayerStateAttackController();
        state_damage        = new PlayerStateDamageController();

        player_state_controllers = new Dictionary <PlayerState, IPlayerStateController>();

        player_state_controllers.Add(PlayerState.player_default, state_default);
        player_state_controllers.Add(PlayerState.player_jump, state_jump);
        player_state_controllers.Add(PlayerState.player_water_default, state_water_default);
        player_state_controllers.Add(PlayerState.player_water_jump, state_water_jump);
        player_state_controllers.Add(PlayerState.player_slide, state_slide);
        player_state_controllers.Add(PlayerState.player_dive, state_dive);
        player_state_controllers.Add(PlayerState.player_water_dive, state_water_dive);
        player_state_controllers.Add(PlayerState.player_attack, state_attack);
        player_state_controllers.Add(PlayerState.player_damage, state_damage);

        // initialise componenets.

        rigid_body             = this.GetComponent <Rigidbody>();
        player_sphere_collider = GameObject.Find
                                     (MAIN_COLLIDER_GAME_OBJECT_NAME).GetComponent <SphereCollider>();
        player_animator  = this.GetComponent <Animator>();
        camera_object    = GameObject.FindGameObjectWithTag(GameConstants.TAG_MAIN_CAMERA);
        player_render    = GameObject.Find(PLAYER_RENDER_GAME_OBJECT_NAME);
        player_renderer  = this.GetComponentInChildren <SkinnedMeshRenderer>();
        player_direction = GameObject.Find(PLAYER_DIRECTION_GAME_OBJECT_NAME);

        // add listeners.

        master.GameStateChange += ChangeGameState;

        // add components.

        audio_source = this.gameObject.AddComponent <AudioSource>();

        audio_source_loop      = this.gameObject.AddComponent <AudioSource>();
        audio_source_loop.loop = true;

        // initialise actor attributes.

        damage_type = new AttributeDamageTypeData();

        // initialise interface.

        camera_audio_manager  = new CameraAudioManager();
        footstep_manager      = new ActorFootstepManager();
        splash_manager        = new ActorSplashManager();
        damage_effect_manager = new ActorDamageEffectManager();

        // setup.

        InitialisePhysicalParameters();
    }