Example #1
0
    void Awake()
    {
        characterController = GetComponent <CharacterController> ();
        camera    = Camera.main;
        mouseLook = new MouseLook();
        mouseLook.Init(transform, camera.transform);

        weapon   = gameObject.GetComponent <PlayerWeapon> ();
        light    = gameObject.GetComponent <PlayerLight> ();
        interact = gameObject.GetComponent <PlayerInteract> ();
        buffs    = gameObject.GetComponent <PlayerBuffs> ();
        traps    = gameObject.GetComponent <PlayerTraps> ();
        ability1 = gameObject.GetComponent <PlayerAbility1> ();
        health   = gameObject.GetComponent <PlayerHealth> ();
        aim      = gameObject.GetComponent <HumanAim> ();
        grenade  = GetComponent <PlayerGrenade> ();
        player   = GetComponent <Player> ();

        animator = GetComponentInChildren <Animator> ();
        audio    = GetComponentInChildren <AudioSource> ();

        gameManager = FindObjectOfType <GameManager> ();

        IsWalking = false;
        IsRunning = false;
        IsJumping = false;

        verticalSpeed = 0f;
        timer         = 0f;
        jetPackTimer  = jetPackTime;
    }
        /// <summary>
        /// Returns how many stacks of a particular buff there are
        /// </summary>
        /// <param name="power"></param>
        /// <returns></returns>
        public static int GetBuffStacks(SNOPower power)
        {
            int stacks;

            if (PlayerBuffs.TryGetValue((int)power, out stacks))
            {
                return(stacks);
            }
            return(0);
        }
Example #3
0
    public Item(GameSave gameSave, int typeIdOffset, int offset, int dataLength, int itemBuffsOffset, int itemBuffsLength, int itemGemsOffset, int itemGemsLength)
    {
        (_gameSave, TypeIdOffset, ItemOffset) = (gameSave, typeIdOffset, offset);
        _levelShiftOffset = (byte)(8 * gameSave.Body[TypeIdOffset + 10]);
        Bytes             = _gameSave.Body.AsSpan(offset, dataLength).ToArray();
        ItemSockets       = new(gameSave, itemGemsOffset, itemGemsLength);
        ItemBuffs         = new(gameSave, this, itemBuffsOffset, itemBuffsLength);
        var span = Bytes.AsSpan(Offsets.BuffCount);

        foreach (var(buffId, _) in BuffDuration.ReadList(ref span))
        {
            PlayerBuffs.Add(Amalur.GetBuff(buffId));
        }
        if (HasCustomName)
        {
            ItemName = _gameSave.Encoding.GetString(Bytes, Offsets.Name, NameLength);
        }
    }
Example #4
0
        public override void Load()
        {
            //basic black background
            bkgrnd = new Texture2D(Game1.graphics.GraphicsDevice, Game1.graphics.GraphicsDevice.DisplayMode.Width, Game1.graphics.GraphicsDevice.DisplayMode.Height,
                false, SurfaceFormat.Color);

            Color[] pixels = new Color[bkgrnd.Width * bkgrnd.Height];

            for (int y = 0; y < bkgrnd.Height; y++)
            {
                for (int x = 0; x < bkgrnd.Width; x++)
                {
                        pixels[y * bkgrnd.Width + x] = Color.Black;
                }
            }

            bkgrnd.SetData<Color>(pixels);

            //new background.
            //Soothing light blue.
            background = new Background(new Vector4(0.1f, 0.6f, 1, 0.25f), true);
            basicEnemyColor = new Color(Vector3.One - background.topColor.ToVector3());
            PlayerBuffs.topColor = background.topColor;
            PlayerBuffs.botColor = background.botColor;

            for (int i = 0; i < Game1.gammgr.saveGameData.totalPlayerBuffs; i++)
            {
                //Add a single player Buff to the GameManager
                PlayerBuffs pb = new PlayerBuffs();
                pb.resetPosition(Game1.gammgr.playerShip.position);
                Game1.gammgr.playerBuffs.Add(pb);
            }

            Game1.gammgr.isPlaying = true;
            Game1.gammgr.isLevelOver = false;
            Game1.gammgr.lh.reset();
            Game1.gammgr.mb.Reset();
            Game1.gammgr.inTutLevel = true;

            loaded = true;

            Game1.musman.PlayNewSong(4);
        }
Example #5
0
    public StashItem(GameSave gameSave, int offset, int dataLength, Gem[] gems)
    {
        ItemOffset = offset;
        Bytes      = gameSave.Body.AsSpan(offset, dataLength).ToArray();
        var span = Bytes.AsSpan(Offsets.BuffCount);

        foreach (var(buffId, _) in BuffDuration.ReadList(ref span))
        {
            PlayerBuffs.Add(Amalur.GetBuff(buffId));
        }
        if (HasCustomName)
        {
            ItemName = gameSave.Encoding.GetString(Bytes, Offsets.Name, NameLength);
        }
        Gems = gems;
        // socket section is either FF
        // or 20 02, followed by int32 count, and int32 handle per gem.
        int socketsStart = gems.Length == 0
            ? Bytes.Length - 1
            : gems[0].ItemOffset - offset - (4 * (1 + gems.Length)) - 2;

        ItemBuffs = Bytes[Offsets.HasItemBuffs] == 0x14 ? new ItemBuffMemory(this, socketsStart) : Definition.ItemBuffs;
    }
Example #6
0
        public StashItem(GameSave gameSave, int offset, int dataLength, Gem[] gems)
        {
            ItemOffset           = offset;
            Bytes                = gameSave.Body.AsSpan(offset, dataLength).ToArray();
            PlayerBuffs.Capacity = BuffCount;
            var firstBuff = Offsets.FirstBuff;

            for (int i = 0; i < PlayerBuffs.Capacity; i++)
            {
                PlayerBuffs.Add(Amalur.GetBuff(MemoryUtilities.Read <uint>(Bytes, firstBuff + (i * 8))));
            }
            if (HasCustomName)
            {
                ItemName = Encoding.UTF8.GetString(Bytes, Offsets.Name, NameLength);
            }
            Gems = gems;
            // socket section is either FF
            // or 20 02, followed by int32 count, and int32 handle per gem.
            int socketsStart = gems.Length == 0
                ? Bytes.Length - 1
                : gems[0].ItemOffset - offset - (4 * (1 + gems.Length)) - 2;

            ItemBuffs = Bytes[Offsets.HasItemBuffs] == 0x14 ? new ItemBuffMemory(this, socketsStart) : Definition.ItemBuffs;
        }
Example #7
0
 void Start()
 {
     singleton = this;
 }
Example #8
0
        public override void Load()
        {
            levelData = LevelManager.LoadLevel(level);

            if (Game1.IS_DEMO)
                Game1.musman.PlayNewSong(Game1.gammgr.r.Next(1, 5));
            else
                Game1.musman.PlayNewSong(Game1.gammgr.r.Next(1, 13));

            //basic black background
            bkgrnd = new Texture2D(Game1.graphics.GraphicsDevice, Game1.graphics.GraphicsDevice.DisplayMode.Width, Game1.graphics.GraphicsDevice.DisplayMode.Height,
                false, SurfaceFormat.Color);

            Color[] pixels = new Color[bkgrnd.Width * bkgrnd.Height];

            for (int y = 0; y < bkgrnd.Height; y++)
            {
                for (int x = 0; x < bkgrnd.Width; x++)
                {
                        pixels[y * bkgrnd.Width + x] = Color.Black;
                }
            }

            bkgrnd.SetData<Color>(pixels);

            //new background.
            //Soothing light blue.
            background = new Background(levelData.colorHigh, levelData.colorLow, true);
            basicEnemyColor = new Color(Vector3.One - background.topColor.ToVector3());
            PlayerBuffs.topColor = background.topColor;
            PlayerBuffs.botColor = background.botColor;

            for (int i = 0; i < Game1.gammgr.saveGameData.totalPlayerBuffs; i++)
            {
                //Add a single player Buff to the GameManager
                PlayerBuffs pb = new PlayerBuffs();
                pb.resetPosition(Game1.gammgr.playerShip.position);
                Game1.gammgr.playerBuffs.Add(pb);
            }

            spawnCounterSwitch = Game1.gammgr.r.Next(levelData.spawnLow, levelData.spawnHigh);

            bmb = new SHMUP.Enemies.BossManBoss(background.topColor, background.botColor);
            bmb.LoadNewBoss(levelData.boss);

            Game1.gammgr.lh.reset();
            Game1.gammgr.mb.Reset();
            Game1.gammgr.inTutLevel = false;

            AwardsManager.shipHit = false;
            AwardsManager.shipDead = false;
            AwardsManager.wallHit = false;
            AwardsManager.missileshot = false;

            wallBreached = false;
            gameovercounter = 0;
            breachedAtY = -1;

            loaded = true;

            Game1.gammgr.isLevelOver = false;

            GC.Collect();
        }