Ejemplo n.º 1
0
        public void SetTarget(Health1 target, GameObject instigator, float damage)
        {
            this.target     = target;
            this.damage     = damage;
            this.instigator = instigator;

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

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

            return(targetToTest != null && !targetToTest.IsDead());
        }
Ejemplo n.º 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");
 }
Ejemplo n.º 6
0
        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());
        }
Ejemplo n.º 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> ();
    }
Ejemplo n.º 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());
        }
    }
Ejemplo n.º 9
0
 private void Awake()
 {
     navMeshAgent = GetComponent <NavMeshAgent>();
     health       = GetComponent <Health1>();
 }
Ejemplo n.º 10
0
 public void Cancel()
 {
     StopAttack();
     target = null;
     GetComponent <Mover>().Cancel();
 }
Ejemplo n.º 11
0
 public void Attack(GameObject combatTarget)
 {
     GetComponent <ActionScheduler>().StartAction(this);
     target = combatTarget.GetComponent <Health1>();
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 13
0
 // Use this for initialization
 void Start()
 {
     player  = GameObject.FindGameObjectWithTag("Player2");
     pHealth = (Health1)FindObjectOfType(typeof(Health1));
     hBar    = (HealthBar1)FindObjectOfType(typeof(HealthBar1));
 }
Ejemplo n.º 14
0
 private void Awake()
 {
     health = GetComponent <Health1>();
 }