public override void TakeMsg(ActorModel who, EventMsg msg) { Debug.Log("trigger"); switch (msg.Type) { case EventType.GetBumped: ActorModel bumper = msg.Source; if (bumper.Type == ThingTypes.Player) { Debug.Log("I touched player"); TileModel loc = who.GetLocation(); //bumper.HasKey = true; who.LeaveTile(who.GetLocation()); bumper.SetLocation(loc); //who.View.GetComponentInChildren<SpriteRenderer>().color = new Color32(255, 255, 255, 255); //who.View.transform.GetComponentInParent<TileView>().GetComponentInChildren<SpriteRenderer>().color = new Color32(255, 255, 255, 255); God.C.AddAction(new GainWallAction(bumper, who)); } return; case EventType.GetName: msg.Text += " KEY"; return; case EventType.WallStop: int WallFace = Random.Range(0, 4); switch (WallFace) { case (0): God.GSM.wallLimit = 0; return; case (1): God.GSM.wallLimit = 1; return; case (2): God.GSM.wallLimit = 2; return; case (3): God.GSM.wallLimit = 3; return; } return; } }
public override void TakeMsg(ActorModel who, EventMsg msg) { switch (msg.Type) { case EventType.GetBumped: ActorModel bumper = msg.Source; if (bumper.Type == ThingTypes.Player) { TileModel loc = who.GetLocation(); bumper.HasKey = true; who.LeaveTile(who.GetLocation()); bumper.SetLocation(loc); God.C.AddAction(new GainKeyAction(bumper, who)); } return; case EventType.GetName: msg.Text += " KEY"; return; } }
public override void TakeMsg(ActorModel who, EventMsg msg) { bool key = false; switch (msg.Type) { case EventType.GetBumped: if (God.GSM.keyIsVisible) { ActorModel bumper = msg.Source; if (bumper.Type == ThingTypes.Player) { TileModel loc = who.GetLocation(); bumper.HasKey = true; God.GSM.hasKey = true; Debug.Log("KEY IS " + key); who.LeaveTile(who.GetLocation()); bumper.SetLocation(loc); who.View.GetComponentInChildren <SpriteRenderer>().color = new Color32(255, 255, 255, 255); who.View.transform.GetComponentInParent <TileView>().GetComponentInChildren <SpriteRenderer>().color = new Color32(255, 255, 255, 255); God.C.AddAction(new GainKeyAction(bumper, who)); } } return; case EventType.GetName: msg.Text += " KEY"; return; case EventType.KeyMove: //Debug.Log("KEY IS MOVING"); if (!God.GSM.hasKey) { if (God.GSM.keyMovement < God.GSM.monsterRound) { God.GSM.keyMovement++; } else if (God.GSM.keyMovement == God.GSM.monsterRound) { int rand = Random.Range(0, 2); Debug.Log(rand); if (rand == 1) { if (who.Location.x > GameSettings.playerX) { who.Move(-1, 0); } else if (who.Location.x < GameSettings.playerX) { who.Move(1, 0); } } else if (rand == 0) { if (who.Location.y > GameSettings.playerY) { who.Move(0, -1); } else if (who.Location.y < GameSettings.playerY) { who.Move(0, 1); } } //God.GSM.AS.PlayOneShot(God.GSM.StompClip); God.GSM.keyMovement = 0; } } return; } }