Example #1
0
    // Use this for initialization
    void Start()
    {
        playerStateEffect = gameObject.GetComponentInChildren <PlayerStateEffect>();
        audioScript       = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <AudioScript>();
        movement          = GetComponent <PhysicMovement1>();
        LevelCam          = GameObject.FindWithTag("MainCamera").GetComponent <MultiTargetCamera>();
        LevelCam.AddTarget(transform);
        roundManager = GameObject.Find("GameManager1").GetComponent <RoundManager>();
        vfxWin       = this.gameObject.transform.Find("VFX_Win").gameObject.GetComponent <ParticleSystem>();
        vfxWin2      = this.gameObject.transform.Find("VFX_Win2").gameObject.GetComponent <ParticleSystem>();

        currHealth = maxHealth;
        roundManager.alivePlayers.Add(this.gameObject);
        currentState = PLAYER_STATE.ALIVE;
        SetPlayerState();
        SetColor();
    }
Example #2
0
    void OnCollisionEnter(Collision collider)
    {
        if (collider.gameObject.tag == "Player")
        {
            physicMovement = collider.gameObject.GetComponent <PhysicMovement1>();
            physicMovement.StopAllCoroutines();
            physicMovement.edgeRecovery = false;
            physicMovement.RecoveryTimer(3);
            rb = collider.gameObject.GetComponent <Rigidbody>();
            anim.SetTrigger("Bump");
            Vector3 dir = collider.contacts[0].point - transform.position;
            dir = dir.normalized;

            rb.AddForce(dir * force);
            playSound();
        }
    }