void Start() { dude = GetComponent <Dude>(); swordzDude = GetComponent <SwordzDude>(); damageable = GetComponent <Damageable>(); actualAttackRate = attackRate + (Random.value - 0.5f) * attackRateFluctuation; lastAttackTime = -actualAttackRate; // HACK : get me outta here! animated = swordzDude.animated; // transform.Find("graphics/bjorn"); avoider = gameObject.GetComponentInChildren <Avoider>(); if (avoider != null) { Physics.IgnoreCollision(collider, avoider.collider); } sqrAttackDistance = Mathf.Pow(attackDistance, 2); sqrDangerDistance = Mathf.Pow(dangerDistance, 2); // offset the start of the think ticks to spread the load out a little lastThought += thinkPeriod * Random.value; lastReact += reactPeriod * Random.value; StartCoroutine("SummoningSickness"); }
void Start() { owner = GetComponent <Dude>(); ownerSwordz = GetComponent <SwordzDude>(); damageable = GetComponent <Damageable>(); if (hotspot == null) { hotspot = transform; } }
void Awake() { character = GetComponent<CharacterController>(); dude = gameObject.GetComponent<Dude>(); swordzDude = gameObject.GetComponent<SwordzDude>(); damageable = gameObject.GetComponent<Damageable>(); detector = gameObject.GetComponentInChildren<Detector>(); //controller = gameObject.GetComponent(typeof(DudeController)) as DudeController; attackers = new List<GameObject>(); }
void Awake() { character = GetComponent <CharacterController>(); dude = gameObject.GetComponent <Dude>(); swordzDude = gameObject.GetComponent <SwordzDude>(); damageable = gameObject.GetComponent <Damageable>(); detector = gameObject.GetComponentInChildren <Detector>(); //controller = gameObject.GetComponent(typeof(DudeController)) as DudeController; attackers = new List <GameObject>(); }
public void Start() { dude = GetComponent(typeof(Dude)) as Dude; swordz = GetComponent(typeof(SwordzDude)) as SwordzDude; cam = Camera.main; if (aimMethod == "mouse") { Screen.showCursor = true; } // automatically set up move axes to match the camera SetMovementAxes(cam.transform.right * 0.5f, cam.transform.forward * 0.5f); }
void Think() { preyObject = GetClosestTarget(); // durr... nothing to kill! if (preyObject == null) { return; } prey = preyObject.GetComponent <Dude>(); preySwordz = preyObject.GetComponent <SwordzDude>(); var damageable = preyObject.GetComponent <Damageable>(); // don't kill dead things // WHAT IS DEAD MAY NEVER DIE if (damageable != null && damageable.GetHealth() <= 0) { return; } // for enemy pack avoidance if (avoider != null && avoider.avoidEnemy != null) { avoidVec = avoider.avoidEnemy.transform.position - transform.position; avoidVec = Vector3.Slerp(distVec.normalized, avoidVec.normalized, 0.5f); } else { avoidVec = Vector3.zero; } // for strafing, if I decide to strafe if (!engagePrey && strafeCooldown <= 0f) { strafeCooldown = strafeRate; strafeDir = 1.0f; if (Random.value > 0.5f) { strafeDir = -1.0f; } } }
void Think() { preyObject = GetClosestTarget(); // durr... nothing to kill! if(preyObject == null) { return; } prey = preyObject.GetComponent<Dude>(); preySwordz = preyObject.GetComponent<SwordzDude>(); var damageable = preyObject.GetComponent<Damageable>(); // don't kill dead things // WHAT IS DEAD MAY NEVER DIE if(damageable != null && damageable.GetHealth() <= 0) { return; } // for enemy pack avoidance if(avoider != null && avoider.avoidEnemy != null) { avoidVec = avoider.avoidEnemy.transform.position - transform.position; avoidVec = Vector3.Slerp(distVec.normalized, avoidVec.normalized, 0.5f); } else { avoidVec = Vector3.zero; } // for strafing, if I decide to strafe if(!engagePrey && strafeCooldown <= 0f) { strafeCooldown = strafeRate; strafeDir = 1.0f; if(Random.value > 0.5f) strafeDir = -1.0f; } }
void Start() { dude = GetComponent<Dude>(); swordzDude = GetComponent<SwordzDude>(); damageable = GetComponent<Damageable>(); actualAttackRate = attackRate + (Random.value - 0.5f) * attackRateFluctuation; lastAttackTime = -actualAttackRate; // HACK : get me outta here! animated = swordzDude.animated; // transform.Find("graphics/bjorn"); avoider = gameObject.GetComponentInChildren<Avoider>(); if(avoider != null) { Physics.IgnoreCollision(collider, avoider.collider); } sqrAttackDistance = Mathf.Pow(attackDistance, 2); sqrDangerDistance = Mathf.Pow(dangerDistance, 2); // offset the start of the think ticks to spread the load out a little lastThought += thinkPeriod * Random.value; lastReact += reactPeriod * Random.value; StartCoroutine("SummoningSickness"); }
void Awake() { health = maxHealth; dude = GetComponent <Dude>(); swordz = GetComponent <SwordzDude>(); }
void Awake() { health = maxHealth; dude = GetComponent<Dude>(); swordz = GetComponent<SwordzDude>(); }
void Start() { owner = GetComponent<Dude>(); ownerSwordz = GetComponent<SwordzDude>(); damageable = GetComponent<Damageable>(); if(hotspot == null) { hotspot = transform; } }
public void Start() { dude = GetComponent(typeof(Dude)) as Dude; swordz = GetComponent(typeof(SwordzDude)) as SwordzDude; cam = Camera.main; if( aimMethod == "mouse" ) Screen.showCursor = true; // automatically set up move axes to match the camera SetMovementAxes(cam.transform.right * 0.5f, cam.transform.forward * 0.5f); }