예제 #1
0
    void OnTriggerEnter()
    {
        Debug.Log("[green] REVERB IN");
        GameObject col_obj = col.GetCollidedObject();

        CompAudio col_audio = col_obj.GetComponent <CompAudio>();

        if (col_audio != null)
        {
            col_audio.SetAuxiliarySends(bus_name, in_value);
        }
    }
예제 #2
0
    void OnTriggerEnter()
    {
        Debug.Log("REVERB ON", Department.STAGE, Color.YELLOW);
        col = GetComponent <CompCollider>();
        GameObject col_obj   = col.GetCollidedObject();
        CompAudio  col_audio = null;

        if (col_obj != null)
        {
            col_audio = col_obj.GetComponent <CompAudio>();
        }
        else
        {
            Debug.Log("COL_OBJ IS NULL!", Department.STAGE, Color.RED);
        }

        if (col_audio != null)
        {
            Debug.Log(in_value);
            col_audio.SetAuxiliarySends(bus_name, in_value);
        }
        else
        {
            Debug.Log("COL_AUDIO IS NULL!", Department.STAGE, Color.RED);
        }
    }
 void OnTriggerEnter()
 {
     if (col.GetCollidedObject().CompareTag("player") && mode_puzzle == ModeBarrel.FILLING && placed)
     {
         sinking = true;
     }
 }
    void OnContact()
    {
        Debug.Log("CONTACT", Department.STAGE, Color.RED);
        CompCollider col          = GetComponent <CompCollider>();
        GameObject   collided_obj = col.GetCollidedObject();



        if (collided_obj != null && destroyed == false)
        {
            if (collided_obj.CompareTag("player"))
            {
                CharactersManager cm = collided_obj.GetComponent <CharactersManager>();

                if (cm != null)
                {
                    cm.GetDamageProjectile(damage);
                }
            }

            Debug.Log(collided_obj.GetTag().ToString(), Department.STAGE);
        }
        else
        {
            Debug.Log("Collided obj NULL", Department.STAGE, Color.ORANGE);
        }

        if (!destroyed)
        {
            destroyed = true;
            col.CollisionActive(false);
            audio.PlayEvent("DaenerysFireballImpact");
            Destroy(gameObject);
        }
    }
    void OnContact()
    {
        Debug.Log("[yellow]Contact Start");
        CompCollider col          = GetComponent <CompCollider>();
        GameObject   collided_obj = col.GetCollidedObject();

        Vector3 point  = col.GetContactPoint();
        Vector3 normal = col.GetContactNormal();

        // DAMAGE ---
        Debug.Log("[error] Collided");
        if (collided_obj != null && destroyed == false)
        {
            /* PLAY AUDIO */
            //GetComponent<CompAudio>().PlayEvent("TheonImpact");
            //Lock transform to avoid trespassing more than one collider
            rb.LockTransform();

            Debug.Log("[yellow] OnContact");
            Debug.Log("[yellow]" + collided_obj.GetName());
        }
        if (destroyed == false)
        {
            Destroy(gameObject);
            destroyed = true;
        }
    }
    void OnTriggerLost()
    {
        CompCollider col = GetComponent <CompCollider>();

        if (col == null)
        {
            Debug.Log("[error] Object doesn't have collider component!");
            return;
        }

        GameObject obj = col.GetCollidedObject();

        //   Debug.Log(obj.GetTag().ToString());


        if (obj.CompareTag("player"))
        {
            Vector3 respawn_pos_float3 = new Vector3(respawn_tile_x * tile_size, respawn_height, respawn_tile_y * tile_size);
            obj.transform.SetPosition(respawn_pos_float3);
            CompRigidBody collbody = obj.GetComponent <CompRigidBody>();
            collbody.ResetForce();
            collbody.LockMotion();
            MovementController controller = obj.GetComponent <MovementController>();
            controller.endPosition = respawn_pos_float3;
            controller.curr_x      = respawn_tile_x;
            controller.curr_y      = respawn_tile_y;
            controller.moving      = false;
            CharactersManager char_manager = obj.GetComponent <CharactersManager>();
            char_manager.SetManagerState(CharactersManager.State.IDLE);
            char_manager.GetDamage(char_manager.drown_dmg);

            MovementController movement = obj.GetComponent <MovementController>();
            movement.drowning = false;
        }
    }
예제 #7
0
    void OnContact()
    {
        col = GetComponent <CompCollider>();
        GameObject obj = col.GetCollidedObject();

        if (obj != null)
        {
            if (enemy_collision && obj.CompareTag("Enemy") && sword_enemy_particle != null)
            {
                col = GetComponent <CompCollider>();
                Vector3 point = col.GetContactPoint();

                col = GetComponent <CompCollider>();
                Vector3 normal = col.GetContactNormal();

                ShieldBlock_Action shield_block = obj.GetComponent <ShieldBlock_Action>();

                if (shield_block != null)
                {
                    if (shield_block.IsBlocking() == true)
                    {
                        return;
                    }
                }
                sword_enemy_particle.GetComponent <Transform>().SetUpVector(normal);
                point = point + normal * 2;
                sword_enemy_particle.GetComponent <Transform>().SetPosition(point);

                enemy_particle = sword_enemy_particle.GetComponent <CompParticleSystem>();
                enemy_particle.ActivateEmission(true);

                if (sword_enemy_particle2 != null)
                {
                    enemy_particle = sword_enemy_particle2.GetComponent <CompParticleSystem>();
                    enemy_particle.ActivateEmission(true);
                }
                if (sword_enemy_particle3 != null)
                {
                    enemy_particle = sword_enemy_particle3.GetComponent <CompParticleSystem>();
                    enemy_particle.ActivateEmission(true);
                }
                if (sword_enemy_particle4 != null)
                {
                    enemy_particle = sword_enemy_particle4.GetComponent <CompParticleSystem>();
                    enemy_particle.ActivateEmission(true);
                }
                //Iterate all childs, they have a ParticleSystem too
                //int childs = sword_enemy_particle.ChildCount();
                //for (int i = 0; i < childs; i++)
                //{
                //    sword_enemy_particle.GetChildByIndex(i).GetComponent<CompParticleSystem>().ActivateEmission(true);
                //}

                //Disable Enemy Collisions
                EnableEnemyCollision(false);
            }
        }
    }
예제 #8
0
    void OnContact()
    {
        CompCollider col          = GetComponent <CompCollider>();
        GameObject   collided_obj = col.GetCollidedObject();

        Vector3 point  = col.GetContactPoint();
        Vector3 normal = col.GetContactNormal();

        // DAMAGE ---
        if (collided_obj != null && destroyed == false)
        {
            /* PLAY AUDIO */
            GetComponent <CompAudio>().PlayEvent("TheonImpact");
            //Lock transform to avoid trespassing more than one collider
            rb.LockTransform();

            // Check the specific enemy in front of you and apply dmg or call object OnContact
            EnemiesManager enemy_manager = GetLinkedObject("player_enemies_manager").GetComponent <EnemiesManager>();
            if (enemy_manager.IsEnemy(collided_obj))
            {
                enemy_manager.ApplyDamage(collided_obj, damage, Enemy_BT.ENEMY_GET_DAMAGE_TYPE.ARROW);
                if (arrow_blood_particles != null)
                {
                    arrow_blood_particles.GetComponent <Transform>().SetUpVector(normal);
                    arrow_blood_particles.GetComponent <Transform>().SetPosition(point + normal * 2);

                    CompParticleSystem arrow_particles_script = arrow_blood_particles.GetComponent <CompParticleSystem>();
                    arrow_particles_script.ActivateEmission(true);
                }
            }
            else
            {
                CompCollider obj_col = collided_obj.GetComponent <CompCollider>();
                if (obj_col != null)
                {
                    obj_col.CallOnContact();
                }
                if (arrow_sparks_particles != null)
                {
                    arrow_sparks_particles.GetComponent <Transform>().SetUpVector(normal);
                    arrow_sparks_particles.GetComponent <Transform>().SetPosition(point + normal * 2);

                    CompParticleSystem wall_particles_script = arrow_sparks_particles.GetComponent <CompParticleSystem>();
                    wall_particles_script.ActivateEmission(true);
                }
            }
        }
        if (destroyed == false)
        {
            Destroy(gameObject);
            destroyed = true;
        }
    }
예제 #9
0
    void OnTriggerEnter()
    {
        if (want_to_close && !door_closed && !enemy_is_dead)
        {
            CompCollider col     = GetComponent <CompCollider>();
            GameObject   obj_col = col.GetCollidedObject();
            Debug.Log(obj_col.GetTag().ToString());

            if (obj_col != null && obj_col.CompareTag("player"))
            {
                CloseDoor();
            }
        }
    }
    void OnTriggerEnter()
    {
        CompCollider col = GetComponent <CompCollider>();

        if (col == null)
        {
            Debug.Log("WARNING: Object doesn't have collider component!");
            return;
        }

        GameObject obj = col.GetCollidedObject();

        obj.transform.SetGlobalPosition(new Vector3(respawn_tile_x * tile_size, respawn_tile_y * tile_size, respawn_height));
    }
예제 #11
0
    void OnTriggerEnter()
    {
        if (go_close_by_collider)
        {
            CompCollider col     = GetComponent <CompCollider>();
            GameObject   obj_col = col.GetCollidedObject();
            Debug.Log(obj_col.GetTag().ToString());

            if (obj_col != null && obj_col.CompareTag("player"))
            {
                CloseDoor();
            }
        }
    }
예제 #12
0
    void OnContact()
    {
        if (fadeing == false && active_fade)
        {
            CompCollider col     = GetComponent <CompCollider>();
            GameObject   obj_col = col.GetCollidedObject();

            if (obj_col != null && obj_col.CompareTag("player"))
            {
                Debug.Log("[yellow] Collision");
                //obj_col.GetComponent<>
                fadeing = true;
            }
        }
    }
예제 #13
0
    void OnTriggerLost()
    {
        Debug.Log("REVERB OUT", Department.STAGE, Color.RED);
        col = GetComponent <CompCollider>();
        GameObject col_obj   = col.GetCollidedObject();
        CompAudio  col_audio = null;

        if (col_obj != null)
        {
            col_audio = col_obj.GetComponent <CompAudio>();
        }
        if (col_audio != null)
        {
            Debug.Log("REVERB OUT", Department.STAGE);
            col_audio.SetAuxiliarySends(bus_name, out_value);
        }
    }
예제 #14
0
    // OnTrigger Lever ------------------------
    void OnTriggerEnter()
    {
        if (active_lever || on_lever_animation)
        {
            return;
        }

        CompCollider col     = GetComponent <CompCollider>();
        GameObject   obj_col = col.GetCollidedObject();

        Debug.Log(obj_col.GetTag().ToString());

        if (obj_col != null && obj_col.CompareTag("player"))
        {
            lever_interact.SetActive(true);
            on_lever_range = true;
        }
    }
예제 #15
0
    void OnTriggerEnter()
    {
        Debug.Log("Collision");
        if (fadeing == false && active_fade)
        {
            Debug.Log("Collision2");
            CompCollider col     = GetComponent <CompCollider>();
            GameObject   obj_col = col.GetCollidedObject();

            if (obj_col != null && obj_col.CompareTag("player"))
            {
                Debug.Log("Collision3");
                //obj_col.GetComponent<>
                state          = StateFade.GO_BLACK;
                fadeing        = true;
                Time.timeScale = 0.0f;
            }
        }
    }
예제 #16
0
    void OnTriggerLost()
    {
        if (active_lever)
        {
            on_lever_range = false;
            return;
        }

        CompCollider col     = GetComponent <CompCollider>();
        GameObject   obj_col = col.GetCollidedObject();

        Debug.Log(obj_col.GetTag().ToString());

        if (obj_col != null && obj_col.CompareTag("player"))
        {
            lever_interact.SetActive(false);
            on_lever_range = false;
        }
    }
    void OnTriggerEnter()
    {
        SceneManager.LoadScene("ScoreMenu");


        Debug.Log("[red] FINISHING LEVEL");
        CompCollider col = GetComponent <CompCollider>();
        GameObject   obj = null;

        if (col != null)
        {
            obj = col.GetCollidedObject();
        }

        if (obj != null && obj.CompareTag("player"))
        {
            Debug.Log("Restarting");
            SceneManager.LoadScene("ScoreMenu");
        }
    }
예제 #18
0
    void OnTriggerEnter()
    {
        if (active_puzzle == false && phase_active == 0)
        {
            CompCollider col     = GetComponent <CompCollider>();
            GameObject   obj_col = col.GetCollidedObject();
            Debug.Log(obj_col.GetTag().ToString());

            if (obj_col != null && obj_col.CompareTag("player"))
            {
                // Close door
                Debug.Log("[yellow] Collision");
                if (door_puzzle_level2 != null)
                {
                    door_puzzle_level2.GetComponent <DoorLevel2>().CloseDoor();
                }
                active_puzzle = true;
            }
        }
    }
    void OnContact()
    {
        col = GetComponent <CompCollider>();
        GameObject obj = col.GetCollidedObject();

        if (obj != null)
        {
            if (obj.CompareTag("enemy"))
            {
                col = GetComponent <CompCollider>();
                Vector3 point = col.GetContactPoint();

                col = GetComponent <CompCollider>();
                Vector3 normal = col.GetContactNormal();

                enemy_particle_obj.GetComponent <Transform>().SetUpVector(normal);
                enemy_particle_obj.GetComponent <Transform>().SetPosition(point);

                enemy_particle = enemy_particle_obj.GetComponent <CompParticleSystem>();
                enemy_particle.ActivateEmission(true);
            }
            else if (obj.CompareTag("obstacle"))
            {
                col = GetComponent <CompCollider>();
                Vector3 point = col.GetContactPoint();

                col = GetComponent <CompCollider>();
                Vector3 normal = col.GetContactNormal();

                wall_particle_obj.GetComponent <Transform>().SetUpVector(normal);
                wall_particle_obj.GetComponent <Transform>().SetPosition(point);

                wall_particle = wall_particle_obj.GetComponent <CompParticleSystem>();
                wall_particle.ActivateEmission(true);
            }
        }
    }