Vector2 seesObject() { DragonMain isdragon = (sees.GetComponent(typeof(DragonMain)) as DragonMain); if (isdragon != null) // Sees Dragon { return(avoid(isdragon.gameObject.transform.position)); } else // Sees something else { if (remember) { if (mood == moods.aggressive) { // Can remember player, hunt them return(Game.player.gameObject.transform.position); } else if (mood == moods.fleeing) { // Can remember player, flee from them return(fleeFrom(Game.player.gameObject.transform.position)); } } return(wandergoal); } }
void Start() { dragon = GetComponent <DragonMain>(); movement = GetComponent <DragonMovement>(); attack = GetComponent <Attack>(); updateWandering(); StartCoroutine(wanderUpdater()); }
void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.GetComponent <Attack>() != null) { print("headbutt!"); DragonMain otherDragon = other.gameObject.GetComponent <DragonMain>(); if ((dragon.isPlayer && !otherDragon.isPlayer) || (!dragon.isPlayer && otherDragon.isPlayer)) { otherDragon.GetComponent <Attack>().GetHit((int)dragon.baseHornDamage); } } }
void Awake() { controller = this; zPlane = new Plane(new Vector3(1, 0, 0), new Vector3(0, 1, 0), Vector3.zero); player = thePlayer; }
void Awake() { dragon = GetComponent <DragonMain>(); anim = GetComponent <Animator>(); }
void Awake() { rigidBody2D = GetComponent <Rigidbody2D>(); dragon = GetComponent <DragonMain>(); anim = GetComponent <Animator>(); }
void Awake() { dragon = GetComponentInParent <DragonMain>(); }
public void AbsorbAttributes(DragonMain other) { if (currentHorns != other.currentHorns) { if (storedHorns == other.currentHorns) { hornsCount++; if (hornsCount == 3) { currentHorns = storedHorns; hornsCount = 0; } } else { storedHorns = other.currentHorns; hornsCount = 1; } } if (currentWings != other.currentWings) { if (storedWings == other.currentWings) { wingsCount++; if (wingsCount == 3) { currentWings = storedWings; wingsCount = 0; } } else { storedWings = other.currentWings; wingsCount = 1; } } if (currentTail != other.currentTail) { if (storedTail == other.currentTail) { tailCount++; if (tailCount == 3) { currentTail = storedTail; tailCount = 0; } } else { storedTail = other.currentTail; tailCount = 1; } } if (currentColour != other.currentColour) { if (storedColour == other.currentColour) { colourCount++; if (hornsCount == 3) { currentColour = storedColour; colourCount = 0; } } else { storedColour = other.currentColour; colourCount = 1; } } UpdateAttributes(); }