/* * States: * * "findNextState" - Check for the player, if found pursue, else stay idle or move * "pursuit"- move towards player until within attacking range * "attack" - swings at teh player * "idle" - stand in place * "stroll" - walk slowly somewhere * "ded" - dies */ void Start() { rg2d = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); playerCheckVars = playerCheck.GetComponent <LookForPlayer>(); rGolemMaterial = new PhysicsMaterial2D(); rg2d.sharedMaterial = rGolemMaterial; rg2d.sharedMaterial.friction = 0f; facingRight = true; state = "findNextState"; stateLock = 0f; inPhysicsMode = false; isVisible = false; randInt = Random.Range(0, 2); if (randInt == 1) { Flip(); } DoStateStep(); }
void Awake() { instance = this; }