public static GameObject CheckItems(Entity entity) { switch (entity.Type) { case "Mushroom": return(new Mushroom(ItemFactory.GetInstance(), new Point(entity.X, entity.Y))); case "OneUp": return(new OneUp(ItemFactory.GetInstance(), new Point(entity.X, entity.Y))); case "Star": return(new Star(ItemFactory.GetInstance(), new Point(entity.X, entity.Y))); case "FireFlower": return(new FireFlower(ItemFactory.GetInstance(), new Point(entity.X, entity.Y))); case "BlockCoin": return(new BlockCoin(ItemFactory.GetInstance(), new Point(entity.X, entity.Y))); case "UndergroundCoin": return(new UndergroundCoin(ItemFactory.GetInstance(), new Point(entity.X, entity.Y), entity.IsAboveGround)); case "PortalGun": return(PortalGun.CreateInstance(ItemFactory.GetInstance(), new Point(entity.X, entity.Y))); default: return(null); } }
public void PortalProjectileCollision(bool blue, GameObject obj, CollisionDirection collisionDirection) { if (PortalGun.GetInstance().TrackingMarioPosition) { PortalGun.GetInstance().GeneratePortal(blue, obj, collisionDirection); } }
public void PortalProjectileFiring() { if (PortalGun.GetInstance().TrackingMarioPosition) { Sounds.SoundPlayer.GetInstance().PlaySoundEffect(Sounds.SoundEffectNames.PortalFire); } }
public void PortalProjectileCollision(bool blue, GameObject obj, CollisionDirection collisionDirection) { //Sounds.SoundPlayer.GetInstance().PlaySoundEffect(Sounds.SoundEffectNames.Win); if (PortalGun.GetInstance().TrackingMarioPosition) { PortalGun.GeneratePortal(blue, obj, collisionDirection); } }
public void AddPortal(PortalModel portalModel) { var portalGun = new PortalGun(this, portalModel); portalGun.Start(); portalGunDict[portalModel] = portalGun; PortalList.Add(portalModel); portalModel.IsRuning = true; }
private void SetupAudio() { audioSource = gameObject.AddComponent <AudioSource>(); PortalGun pg = GameObject.FindObjectOfType <PortalGun>(); audioSource.playOnAwake = false; shootSound = pg.shootSound; teleportSound = pg.teleportSound; }
public ATPortal(PortalGun OwnerGun) { this.accuracy = 0.75f; this.range = 250f; this.penetration = 1f; this.bulletSpeed = 20f; this.rebound = true; this.bulletThickness = 0.3f; this._ownerGun = OwnerGun; }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
private void Awake() { if (transform == portalGun1) { anotherPortalGun = portalGun2.GetComponent <PortalGun> (); } else if (transform == portalGun2) { anotherPortalGun = portalGun1.GetComponent <PortalGun> (); } }
public SaveFriendState() { enteredTrigger = false; isNearFriend = false; player = GameManager.GetPlayer(); friend = GameManager.GetFriend(); friendMaterial = friend.GetComponentInChildren <SkinnedMeshRenderer>().material; friendTrigger = friend.GetComponentInChildren <BoxCollider>(); friendTrigger.enabled = true; playerAnimator = player.GetComponent <Animator>(); portalGun = GameManager.GetArtifact().GetComponent <PortalGun>(); }
public override void Update() { this.mario.IsCollidable = false; this.mario.gravity.Disable(); this.mario.YSpeed = 1.0f; this.mario.XSpeed = 0.0f; this.mario.ChangeActionState(new MarioJumpState(this.mario, false, lastAction)); if (this.mario.IsFacingLeft) { this.mario.Sprite = this.mario.SpriteFactory.CreateProduct(MarioTypes.IdleLeft); } else { this.mario.Sprite = this.mario.SpriteFactory.CreateProduct(MarioTypes.IdleRight); } if (this.mario.PositionInGame.Y >= this.descendDistance) { this.mario.gravity.Enable(); this.mario.PositionInGame = new Point(warpX, warpY); if (warpX > Camera.AquireInstance().LevelWidth + 512) { int width = Camera.AquireInstance().VirtualWidth; int height = Camera.AquireInstance().VirtualHeight; Camera.AquireInstance().Limits = new Rectangle(Camera.AquireInstance().LevelWidth + width, 0, width * 10, height); BlockUpdateEvent.GetInstance().ChangeBlocksToUndergroundBlocks(); PortalGun.ResetPortals(); } else if (warpX > Camera.AquireInstance().LevelWidth) { int width = Camera.AquireInstance().VirtualWidth; int height = Camera.AquireInstance().VirtualHeight; Camera.AquireInstance().Limits = new Rectangle(Camera.AquireInstance().LevelWidth, 0, width, height); BlockUpdateEvent.GetInstance().ChangeBlocksToUndergroundBlocks(); PortalGun.ResetPortals(); } else { int height = Camera.AquireInstance().VirtualHeight; Camera.AquireInstance().Limits = new Rectangle(0, 0, Camera.AquireInstance().LevelWidth, height); BlockUpdateEvent.GetInstance().ChangeBlocksToAbovegroundBlocks(); PortalGun.ResetPortals(); } this.mario.ChangeActionState(new MarioJumpState(this.mario, false, lastAction)); this.mario.ChangePowerUpState(new PipeExitState(this.mario, lastAction, lastPower)); this.mario.IsCollidable = true; } }
public void Execute() { if (PortalGun.GetInstance().TrackingMarioPosition) { if (left) { new PortalProjectile(true); } else { new PortalProjectile(false); } } }
public void Init() { foreach (var portalModel in PortalList) { try { var portalGun = new PortalGun(this, portalModel); portalGun.Start(); portalGunDict[portalModel] = portalGun; portalModel.IsRuning = true; } catch { portalModel.IsRuning = false; } } }
public void SetOwner(PortalGun player) { m_Owner = player; }
PortalGun pGun; //holds the portal gun // Use this for initialization void Start() { mainCamera = GameObject.FindWithTag("MainCamera"); //set the main camera pGun = gameObject.GetComponent <PortalGun>(); //set the portal gun }
private void Awake() { character = GetComponent <PlatformerCharacter2D>(); holdPoint = GameObject.Find("HoldPoint"); portalGun = GetComponentInChildren <PortalGun>(); }