Example #1
0
 void Awake()
 {
     anim = GetComponent <Animator> ();
     rb   = this.GetComponent <Rigidbody> ();
     what = this.GetComponent <PlayerMovement> ();
     dam  = this.GetComponent <DamageSetGet> ();
 }
Example #2
0
 // Use this for initialization
 void Start()
 {
     thisAnim  = this.GetComponent <Animator> ();
     pmov      = player.GetComponent <PlayerMovement> ();
     rb        = this.GetComponent <Rigidbody> ();
     otherAnim = player.GetComponent <Animator> ();
     ma        = player.GetComponent <MachineAverage> ();
     dam       = this.GetComponent <DamageSetGet> ();
 }
Example #3
0
    //public float time = 0f;
    //public bool canMoveSideways = true;

    void Awake()
    {
        rb              = this.GetComponent <Rigidbody> ();
        anim            = this.GetComponent <Animator> ();
        Physics.gravity = new Vector3(0, -20, 0);
        canMove         = true;
        thisName        = this.gameObject.name;
        pd              = this.GetComponent <PlayerDetection> ();
        dam             = this.GetComponent <DamageSetGet> ();
        ma              = this.GetComponent <MachineAverage> ();
    }
Example #4
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == hitTag && meDam.justHit == false)
     {
         hitValues = other.GetComponent <HitData> ();
         dir       = other.GetComponentInParent <PlayerMovement> ();
         themDam   = other.GetComponentInParent <DamageSetGet> ();
         themRB    = other.GetComponentInParent <Rigidbody> ();
         Debug.Log("Current rotation:" + themRB.rotation);
         if (dir.facingRight)
         {
             meRB.velocity = new Vector3(hitValues.knockback * Mathf.Cos(hitValues.launchAngle * Mathf.PI / 180), hitValues.knockback * Mathf.Sin(hitValues.launchAngle * Mathf.PI / 180), 0) * Mathf.Pow(2, meDam.currentDamage / 100);
         }
         else
         {
             meRB.velocity = new Vector3(-hitValues.knockback * Mathf.Cos(hitValues.launchAngle * Mathf.PI / 180), hitValues.knockback * Mathf.Sin(hitValues.launchAngle * Mathf.PI / 180), 0) * Mathf.Pow(2, meDam.currentDamage / 100);
         }
         meDam.justHit = true;
         themDam.consecutiveHits++;
         anim.SetTrigger("hurt");
         meDam.currentDamage += hitValues.damageAmount;
         Debug.Log(this.name + "Hit for damage: " + hitValues.damageAmount + "\nCurrent damage: " + meDam.currentDamage);
     }
 }
Example #5
0
 void Awake()
 {
     pcdam = PC.GetComponent <DamageSetGet> ();
     bgdam = BG.GetComponent <DamageSetGet> ();
 }
Example #6
0
 void Awake()
 {
     meDam = this.GetComponentInParent <DamageSetGet>();
     meRB  = this.GetComponentInParent <Rigidbody> ();
     anim  = this.GetComponentInParent <Animator> ();
 }
Example #7
0
 // Use this for initialization
 void Awake()
 {
     posi = this.transform.position;
     rb   = this.GetComponent <Rigidbody>();
     hit  = this.GetComponentInChildren <DamageSetGet> ();
 }