// Start is called before the first frame update void Start() { rBody = GetComponent <Rigidbody2D>(); bridgeScript = GetComponent <BridgeSpawn>(); portalScript = GetComponent <PortalSpawn>(); if ((Dog.GetComponent <Rigidbody2D>().transform.localScale.x == -1) && (Dog.GetComponent <Rigidbody2D>().transform.rotation.z == 0)) // shoots right when facing right, and shooting left when facing left. -1 right 1 left { rBody.velocity = Vector2.right * speed; } if ((Dog.GetComponent <Rigidbody2D>().transform.localScale.x == 1) && (Dog.GetComponent <Rigidbody2D>().transform.rotation.z == 0)) { rBody.velocity = Vector2.left * speed; } if ((Dog.GetComponent <Rigidbody2D>().transform.localScale.x == -1) && Dog.GetComponent <Rigidbody2D>().transform.rotation.z != 0) { rBody.velocity = Vector2.left * speed; } if ((Dog.GetComponent <Rigidbody2D>().transform.localScale.x == 1) && Dog.GetComponent <Rigidbody2D>().transform.rotation.z != 0) { rBody.velocity = Vector2.right * speed; } }
private void PortalSpawn() { var fp = _pathPoints.FirstOrDefault(); GameObject portal = Instantiate(_simplePortalPrefab, Tiles[_simplePortPosition] .GetComponent <TileScript>().WorldPos, Quaternion.identity); RatPortal = portal.GetComponent <PortalSpawn>(); RatPortal.name = "RatPortal"; }
public Portal(PortalSpawn spawn) : this(spawn.X, spawn.Y, spawn.ID, spawn.GotoUp, spawn.GotoDown, spawn.GotoLeft, spawn.GotoRight, spawn.ReverseDirection) { }