Example #1
0
 public void OnTriggerEnter(Collider other)
 {
     print("OnTriggerEnter: " + other.gameObject.name);
     if ("TriggerBall".Equals(other.gameObject.name))
     {
         InteractableItem collidedItem = other.GetComponent <Collider>().GetComponent <InteractableItem> ();
         if (collidedItem)
         {
             objectsHoveringOver.Add(collidedItem);
         }
         Debug.Log("Count:" + objectsHoveringOver.Count);
     }
     if ("Goblin".Equals(other.gameObject.tag))
     {
         GoblinController gc = other.gameObject.GetComponent <GoblinController> ();
         gc.PlayIsDying();
     }
 }
    void Start()
    {
        goblinController = GetComponent<GoblinController>();

        if (isCommon == true)
        {
            commonGoblin = RandCommonGoblin();
            enemyName.GetComponent<TextMesh>().text = commonGoblin.name;
            goblinHealth = commonGoblin.maxHealth;
            healthScaleConstant = 0.01f / (goblinHealth / 100f);
            goblinFinalDamage = commonGoblin.goblinDamage;
            goblinFinalCSpeed = commonGoblin.chaseSpeed;
            goblinFinalMSpeed = commonGoblin.movementSpeed;
            goblinFinalAxeDamage = commonGoblin.axeDamage;
            goblinController.moveSpeed = goblinFinalMSpeed;
            goblinController.chaseSpeed = goblinFinalCSpeed;

        }
        else if (isSwift == true)
        {
            swiftGoblin = RandSwiftGoblin();
            enemyName.GetComponent<TextMesh>().text = swiftGoblin.name;
            goblinHealth = swiftGoblin.maxHealth;
            healthScaleConstant = 0.01f / (goblinHealth / 100f);
            goblinFinalDamage = swiftGoblin.goblinDamage;
            goblinFinalCSpeed = swiftGoblin.chaseSpeed;
            goblinFinalMSpeed = swiftGoblin.movementSpeed;
            goblinFinalAxeDamage = swiftGoblin.axeDamage;
            goblinController.moveSpeed = goblinFinalMSpeed;
            goblinController.chaseSpeed = goblinFinalCSpeed;

        }
        else if (isStrong == true)
        {
            strongGoblin = RandStrongGoblin();
            enemyName.GetComponent<TextMesh>().text = strongGoblin.name;
            goblinHealth = strongGoblin.maxHealth;
            healthScaleConstant = 0.01f / (goblinHealth / 100f);
            goblinFinalDamage = strongGoblin.goblinDamage;
            goblinFinalCSpeed = strongGoblin.chaseSpeed;
            goblinFinalMSpeed = strongGoblin.movementSpeed;
            goblinFinalAxeDamage = strongGoblin.axeDamage;
            goblinController.moveSpeed = goblinFinalMSpeed;
            goblinController.chaseSpeed = goblinFinalCSpeed;
        }
    }
Example #3
0
 void Start()
 {
     parent     = gameObject.GetComponentInParent <GoblinController>();
     max        = parent.lives;
     localScale = transform.localScale;
 }
Example #4
0
 private void Awake()
 {
     controller = GetComponent <GoblinController>();
 }
 // Start is called before the first frame update
 void Start()
 {
     goblinController = goblinTransform.GetComponent <GoblinController>();
     animator         = this.GetComponent <Animator>();
 }
 void Start()
 {
     enemyHealth = startingHealth;
     healthScaleConstant = 0.01f / (enemyHealth / 100f);
     if(GetComponent<GoblinController>() != null)
     {
         isGoblinController = true;
         goblinController = GetComponent<GoblinController>();
     }
     else
     {
         isGoblinController = false;
         skeletonController = GetComponent<SkeletonController>();
     }
 }