Beispiel #1
0
        public void SetTarget(Health1 target, GameObject instigator, float damage)
        {
            this.target     = target;
            this.damage     = damage;
            this.instigator = instigator;

            Destroy(gameObject, maxLifeTime);
        }
Beispiel #2
0
        private void Awake()
        {
            fighter = GetComponent <Fighter>();
            health  = GetComponent <Health1>();
            mover   = GetComponent <Mover>();
            player  = GameObject.FindWithTag("Player");

            guardPosition = new LazyValue <Vector3>(GetGuardPosition);
        }
 void Awake()
 {
     // Setting up the references.
     player       = GameObject.FindGameObjectWithTag("Player");
     playerHealth = player.GetComponent <Health1> ();
     enemyHealth  = GetComponent <Health>();
     anim         = GetComponent <Animator> ();
     audio        = GetComponent <AudioSource> ();
 }
Beispiel #4
0
        public bool CanAttack(GameObject combatTarget)
        {
            if (combatTarget == null)
            {
                return(false);
            }
            Health1 targetToTest = combatTarget.GetComponent <Health1>();

            return(targetToTest != null && !targetToTest.IsDead());
        }
Beispiel #5
0
 private void Start()
 {
     body               = GetComponent <Rigidbody2D>();
     pHealth            = (Health1)FindObjectOfType(typeof(Health1));
     hBar               = (HealthBar1)FindObjectOfType(typeof(HealthBar1));
     transform.position = spawnPoint.transform.position;
     l11 = GameObject.FindGameObjectWithTag("L11");
     l21 = GameObject.FindGameObjectWithTag("L21");
     l31 = GameObject.FindGameObjectWithTag("L31");
 }
        private void Update()
        {
            if (fighter.GetTarget() == null)
            {
                GetComponent <Text>().text = "N/A";
                return;
            }
            Health1 health = fighter.GetTarget();

            GetComponent <Text>().text = String.Format("{0:0}/{1:0}", health.GetHealthPoints(), health.GetMaxHealthPoints());
        }
Beispiel #7
0
    void Awake()
    {
        // Set up the references.
        player = GameObject.FindGameObjectWithTag("Player").transform;

        playerHealth = player.GetComponent <Health1> ();

        enemyHealth = GetComponent <Health> ();
        nav         = GetComponent <NavMeshAgent> ();
        anim        = GetComponent <Animator> ();
    }
Beispiel #8
0
    void OnTriggerEnter(Collider vOther)
    {
        Health1 tH = vOther.GetComponent <Health1> ();

        if (tH != null)
        {
            Destroy(gameObject);
            tH.TakeDamage(15);
//			CmdHit (tNID.netId);
        }
        Enemy tE = vOther.GetComponent <Enemy> ();

        if (tE != null)
        {
            tE.NewColour(Random.ColorHSV());
        }
    }
Beispiel #9
0
 private void Awake()
 {
     navMeshAgent = GetComponent <NavMeshAgent>();
     health       = GetComponent <Health1>();
 }
Beispiel #10
0
 public void Cancel()
 {
     StopAttack();
     target = null;
     GetComponent <Mover>().Cancel();
 }
Beispiel #11
0
 public void Attack(GameObject combatTarget)
 {
     GetComponent <ActionScheduler>().StartAction(this);
     target = combatTarget.GetComponent <Health1>();
 }
Beispiel #12
0
        public void LaunchProjectile(Transform rightHand, Transform leftHand, Health1 target, GameObject instigator, float calculatedDamage)
        {
            Projectile projectileInstance = Instantiate(projectile, GetTransform(rightHand, leftHand).position, Quaternion.identity);

            projectileInstance.SetTarget(target, instigator, calculatedDamage);
        }
Beispiel #13
0
 // Use this for initialization
 void Start()
 {
     player  = GameObject.FindGameObjectWithTag("Player2");
     pHealth = (Health1)FindObjectOfType(typeof(Health1));
     hBar    = (HealthBar1)FindObjectOfType(typeof(HealthBar1));
 }
Beispiel #14
0
 private void Awake()
 {
     health = GetComponent <Health1>();
 }