Наследование: MonoBehaviour
Пример #1
0
        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);
            }
        }
Пример #2
0
 public void PortalProjectileCollision(bool blue, GameObject obj, CollisionDirection collisionDirection)
 {
     if (PortalGun.GetInstance().TrackingMarioPosition)
     {
         PortalGun.GetInstance().GeneratePortal(blue, obj, collisionDirection);
     }
 }
Пример #3
0
 public void PortalProjectileFiring()
 {
     if (PortalGun.GetInstance().TrackingMarioPosition)
     {
         Sounds.SoundPlayer.GetInstance().PlaySoundEffect(Sounds.SoundEffectNames.PortalFire);
     }
 }
Пример #4
0
 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);
     }
 }
Пример #5
0
        public void AddPortal(PortalModel portalModel)
        {
            var portalGun = new PortalGun(this, portalModel);

            portalGun.Start();
            portalGunDict[portalModel] = portalGun;
            PortalList.Add(portalModel);
            portalModel.IsRuning = true;
        }
Пример #6
0
    private void SetupAudio()
    {
        audioSource = gameObject.AddComponent <AudioSource>();
        PortalGun pg = GameObject.FindObjectOfType <PortalGun>();

        audioSource.playOnAwake = false;
        shootSound    = pg.shootSound;
        teleportSound = pg.teleportSound;
    }
Пример #7
0
 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;
 }
Пример #8
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
Пример #9
0
 private void Awake()
 {
     if (transform == portalGun1)
     {
         anotherPortalGun = portalGun2.GetComponent <PortalGun> ();
     }
     else if (transform == portalGun2)
     {
         anotherPortalGun = portalGun1.GetComponent <PortalGun> ();
     }
 }
Пример #10
0
 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>();
 }
Пример #11
0
        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;
            }
        }
Пример #12
0
 public void Execute()
 {
     if (PortalGun.GetInstance().TrackingMarioPosition)
     {
         if (left)
         {
             new PortalProjectile(true);
         }
         else
         {
             new PortalProjectile(false);
         }
     }
 }
Пример #13
0
 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;
         }
     }
 }
Пример #14
0
 public void SetOwner(PortalGun player)
 {
     m_Owner = player;
 }
Пример #15
0
    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
    }
Пример #16
0
 private void Awake()
 {
     character = GetComponent <PlatformerCharacter2D>();
     holdPoint = GameObject.Find("HoldPoint");
     portalGun = GetComponentInChildren <PortalGun>();
 }