private void Update() { switch (agentType) { case AgentType.Player: if (Input.GetKeyDown(KeyCode.Space)) { AgentScripts.PillShootSetup( master, xxi.banks["pill"].Spawn <InsiderBasicAgent>(xxi.GetEntLot("guys")), transform.position, GetComponent <FacingData>().facing); } break; } }
private void FixedUpdate() { switch (agentType) { case AgentType.Player: twin pin = new twin(Util.sign(Input.GetAxisRaw("Horizontal")), Util.sign(Input.GetAxisRaw("Vertical"))); body.velocity = body.velocity * 0.9f + 0.1f * (Vector2)pin * 50; if (pin.taxicabLength == 1) { GetComponent <FacingData>().facing = pin; } transform.rotation = Quaternion.Euler(0, 0, Vector2.SignedAngle(twin.up, GetComponent <FacingData>().facing)); break; case AgentType.Pill: AgentScripts.PillFixedUpdate(this); break; case AgentType.RedBlood: case AgentType.WhiteBlood: case AgentType.Virus: case AgentType.Oxygen: if (IsWithinDistOfCentered(2f)) { // great, keep going var dirs = new ChoiceStack <twin>(twin.compass); dirs.RemoveAll(-lastMove); lastMove = dirs.GetFirstTrue(TryMove); } else { body.velocity = ToCentered().normalized * 20; } break; case AgentType.BodyHeart: body.velocity = ToCentered().normalized * 20; break; } }