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;
        }
    }
Пример #2
0
    void Start()
    {
        Debug.Log("Vfront" + vfront, Department.PLAYER, Color.ORANGE);
        rb = GetComponent <CompRigidBody>();
        Shoot();
        timer = 0.0f;

        GetComponent <CompAudio>().PlayEvent("DaenerysFireballImpact");

        if (fireball == false)
        {
            if (vfront.x >= 2)
            {
                final_pos = transform.GetPosition().x + 25.4f * distance;
            }
            else if (vfront.x <= -2)
            {
                final_pos = transform.GetPosition().x - 25.4f * distance;
            }
            else if (vfront.z >= 2)
            {
                final_pos = transform.GetPosition().z + 25.4f * distance;
            }
            else if (vfront.z <= -2)
            {
                final_pos = transform.GetPosition().z - 25.4f * distance;
            }
        }
    }
Пример #3
0
 void Start()
 {
     rb        = GetComponent <CompRigidBody>();
     destroyed = false;
     Shoot();
     collision = true;
 }
    void Start()
    {
        rb    = GetComponent <CompRigidBody>();
        audio = GetComponent <CompAudio>();
        Shoot();
        collision = true;

        audio.PlayEvent("DaenerysFireballImpact");
    }
Пример #5
0
    void ResetColliderPosition()
    {
        dynamic_collider = GetComponent <CompRigidBody>();

        Vector3 position = dynamic_collider.GetColliderPosition();

        position -= transform.forward;
        Quaternion rotation = dynamic_collider.GetColliderQuaternion();

        dynamic_collider.MoveKinematic(position, rotation);
    }
Пример #6
0
    public void CheckAttackTarget()
    {
        dynamic_collider = GetComponent <CompRigidBody>();

        Vector3 position = dynamic_collider.GetColliderPosition();

        position += transform.forward;
        Quaternion rotation = dynamic_collider.GetColliderQuaternion();

        dynamic_collider.MoveKinematic(position, rotation);
        expecting_collision = true;
    }
Пример #7
0
 public void CheckDrawning()
 {
     if (level_map[curr_x, curr_y] == 3) //Valryian Fire!
     {
         if (GetLinkedObject("player_obj").GetComponent <CharactersManager>().god_mode == false)
         {
             CompRigidBody rb = GetComponent <CompRigidBody>();
             rb.UnLockMotion();
             rb.ApplyImpulse(new Vector3(0.0f, -50.0f, 0.0f));
             //char_manager.Drown();
             drowning = true;
         }
     }
 }
    void OnContact()
    {
        if (collided == false)
        {
            GameObject collided_obj = GetComponent <CompCollider>().GetCollidedObject();

            // DAMAGE ---
            if (collided_obj != null)
            {
                rb = GetComponent <CompRigidBody>();
                //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))
                {
                    collided = true;
                    enemy_manager.ApplyDamage(collided_obj, damage, Enemy_BT.ENEMY_GET_DAMAGE_TYPE.FIREBREATH);
                }
            }
        }
    }
 void Start()
 {
     rb       = GetComponent <CompRigidBody>();
     collided = false;
 }
Пример #10
0
 void Start()
 {
     rb = GetComponent <CompRigidBody>();
     Shoot();
     damage = 10.0f;
 }