Inheritance: MonoBehaviour
Example #1
0
 // Use this for initialization
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Example #2
0
    public void TakeDamage(float amt)
    {
        health -= amt;
        DamageFlash.Flash();
        AudioSource.PlayClipAtPoint(hurtClip, transform.position);

        if (health <= 0)
        {
            // TODO: Death animation?

            PlayerPrefs.SetInt("Victory", 0);
            Application.LoadLevel("gameOver");
        }
    }
Example #3
0
    void Start()
    {
        Time.timeScale = 1f;

        damage_camera = GetComponent <DamageFlash>();
        damage_camera.UpdateDamage(health);

        AudioManager.SetAmbience(AmbienceType.ABOVE);

        last_pos = transform.position;

        cam_follow_target = transform.Find("Camera Follow Target");
        cam_lookat_target = transform.Find("Camera Look Target");

        SetFlightMode(FlightMode.HIGH, false);

        transform.position = new Vector3(transform.position.x, high_altitude, transform.position.z);
    }
Example #4
0
        // Use this for initialization
        private void Start()
        {
            hittimer = 0;
            lives    = game_settings.playerLives - 1;
            m_CharacterController = GetComponent <CharacterController>();
            ani = GetComponentInChildren <ResetPostion>().GetComponent <Animator>();

            m_Camera = GetComponentInChildren <Camera>();
            m_OriginalCameraPosition = m_Camera.transform.localPosition;
            m_FovKick.Setup(m_Camera);
            m_HeadBob.Setup(m_Camera, m_StepInterval);
            m_StepCycle   = 0f;
            m_NextStep    = m_StepCycle / 2f;
            m_Jumping     = false;
            m_AudioSource = GetComponent <AudioSource>();
            m_MouseLook.Init(transform, m_Camera.transform);

            weapon          = GetComponentInChildren <WeaponStats>();
            damageFlash     = (DamageFlash)GetComponent(typeof(DamageFlash));
            healFlash       = (HealFlash)GetComponent(typeof(HealFlash));
            attackSoundPlay = true;

            //Healthbar = GetComponentInChildren<Slider>();
        }
Example #5
0
 public void Awake()
 {
     flasher = GetComponent <DamageFlash>();
 }
Example #6
0
 private void Awake()
 {
     controller       = GetComponent <PlayerController>();
     weaponController = GetComponent <WeaponController>();
     damageFlash      = GetComponentInChildren <DamageFlash>();
 }
Example #7
0
 private void Start()
 {
     sRender     = GetComponent <SpriteRenderer>();
     damageFlash = GetComponent <DamageFlash>();
 }
Example #8
0
 // Use this for initialization
 void Start()
 {
     if(instance==null) {
         instance = this;
     }
 }