Exemple #1
0
    // Start is called before the first frame update
    void Start()
    {
        float rand = Random.value;

        if (rand <= 0.25f)
        {
            pickupType = PickupType.Speed;
        }
        else
        {
            pickupType = PickupType.Bullet;
        }

        int integer = (int)pickupType;

        switch (integer)
        {
        case 0:
            GetComponentInChildren <MeshRenderer>().material = pickupColour[0];
            break;

        case 1:
            GetComponentInChildren <MeshRenderer>().material = pickupColour[1];
            break;
        }
    }
Exemple #2
0
        public bool Equals(Pickup other)
        {
            if (other == null)
            {
                return(false);
            }

            return(Index.Equals(other.Index) &&
                   Unknown04h.Equals(other.Unknown04h) &&
                   Unknown08h.Equals(other.Unknown08h) &&
                   Amount.Equals(other.Amount) &&
                   Unknown10h.Equals(other.Unknown10h) &&
                   Unknown14h.Equals(other.Unknown14h) &&
                   Blip.Equals(other.Blip) &&
                   Timer.Equals(other.Timer) &&
                   Position.Equals(other.Position) &&
                   Unknown2Ch.Equals(other.Unknown2Ch) &&
                   Unknown30h.Equals(other.Unknown30h) &&
                   Rotation.Equals(other.Rotation) &&
                   Unknown40h.Equals(other.Unknown40h) &&
                   ObjectId.Equals(other.ObjectId) &&
                   RefNum.Equals(other.RefNum) &&
                   PickupType.Equals(other.PickupType) &&
                   Flags.Equals(other.Flags) &&
                   Flags2.Equals(other.Flags2) &&
                   Unknown4Bh.Equals(other.Unknown4Bh) &&
                   Unknown4Ch.Equals(other.Unknown4Ch) &&
                   Unknown50h.Equals(other.Unknown50h));
        }
Exemple #3
0
    public void Init(StatType type, int amount)
    {
        PickupType pickup = PickupType.BLUE_KEY;

        switch (type)
        {
        case StatType.LIFE:
            pickup = PickupType.LIFE;
            break;

        case StatType.POWER:
            pickup = PickupType.POWER;
            break;

        case StatType.DEFENSE:
            pickup = PickupType.DEFENSE;
            break;

        case StatType.EXPERIENCE:
            pickup = PickupType.EXPERIENCE;
            break;
        }
        this.pickup = pickup;
        this.amount = amount;
    }
    public void SpawnRandomPickup(int index, Vector3 spawnPos)
    {
        PickupType pickupType = (PickupType)Random.Range((int)PickupType.None + 1, (int)PickupType.MaxPickup);
        GameObject obj        = Instantiate(GetPrefabForType(pickupType), spawnPos, Quaternion.identity) as GameObject;

        activePickups.Add(new PickupObject(obj, index, pickupType));
    }
Exemple #5
0
    bool SetSwapPlayers()
    {
        players = new GameObject[0];
        players = GameObject.FindGameObjectsWithTag("Player");


        m_CurrentPlayer = new GameObject();
        m_SwapPlayer    = new GameObject();
        float tempHighest = 0.0f;

        for (int i = 0; i < players.Length; i++)
        {
            if (players[i].transform.position.y > tempHighest)
            {
                tempHighest  = players[i].transform.position.y;
                m_SwapPlayer = players[i];
            }

            if (players[i].GetComponent <CharacterController>().name == m_PlayerNumber)
            {
                m_CurrentPlayer = players[i];
            }
        }

        if (m_CurrentPlayer == m_SwapPlayer)//Cant swap withself
        {
            return(false);
        }
        else
        {
            m_Type = PickupType.empty;
            return(true);
        }
    }
    public void Collect(PickupType type)
    {
        // increment respective collectables
        switch (type)
        {
        case PickupType.coin:
            coinCount++;
            uiCoins.text = "Coins: " + coinCount;
            break;

        case PickupType.gem:
            gemCount++;
            uiGems.text = "Gems: " + gemCount + "/5";
            if (gemCount >= 5)
            {
                uiWinText.enabled = true;
            }
            break;

        case PickupType.xp:
            xpCount++;
            uiXPBar.value = ((float)xpCount) / ((float)levelUpThreshold);
            if (xpCount == levelUpThreshold)
            {
                LevelUp();
            }
            break;

        case PickupType.xpCase:
            //do nothing
            break;
        }
    }
Exemple #7
0
 void DisplayKey(PickupType keyToDisplay)
 {
     foreach (var key in ItemDictionary.Keys)
     {
         ItemDictionary[key].SetActive(key == keyToDisplay);
     }
 }
 public cPickupInfo(PickupType pickup_type, cBaseRenderer renderer, Vector2f hit_rect_size, PickupEffectFunction effect)
 {
     this.pickupType  = pickup_type;
     this.renderer    = renderer;
     this.hitRectSize = hit_rect_size;
     this.effect      = effect;
 }
    public void AddItem(ItemType itemType, int amount, PickupType pickupType)
    {
        if (m_Items.ContainsKey(itemType) == true)
        {
            m_Items[itemType] += amount;
        }
        else
        {
            m_Items.Add(itemType, amount);
        }

        if (amount > 0)
        {
            ItemData itemData = Database.Item.FindItem(itemType);

            if (itemData != null)
            {
                if (itemData.GetPickupAnimation(pickupType) != ItemData.PickupAnimation.None)
                {
                    m_MovementModel.ShowItemPickup(itemType, pickupType);
                }

                if (itemData.IsEquipable == ItemData.EquipPosition.SwordHand)
                {
                    m_MovementModel.EquipWeapon(itemType);
                }
                else if (itemData.IsEquipable == ItemData.EquipPosition.ShieldHand)
                {
                    m_MovementModel.EquipShield(itemType);
                }
            }
        }
    }
 public cPickupInfo()
 {
     this.pickupType  = PickupType.UNKNOWN;
     this.renderer    = null;
     this.hitRectSize = new Vector2f(0, 0);
     this.effect      = null;
 }
        /// <summary>
        /// Restores the general variable parameters
        /// Called from within the MSTSWagon class.
        /// </summary>
        public void Restore(BinaryReader inf)
        {
            FreightWeight = inf.ReadSingle();
            var fType = inf.ReadInt32();

            FreightType = (PickupType)fType;
            LoadedOne   = null;
            foreach (var freightAnim in Animations)
            {
                if (freightAnim is FreightAnimationContinuous)
                {
                    if ((freightAnim as FreightAnimationContinuous).LinkedIntakePoint != null)
                    {
                        if ((freightAnim as FreightAnimationContinuous).LinkedIntakePoint.Type == FreightType)
                        {
                            LoadedOne             = freightAnim as FreightAnimationContinuous;
                            LoadedOne.LoadPerCent = FreightWeight / LoadedOne.FreightWeightWhenFull * 100;
                        }
                        else
                        {
                            (freightAnim as FreightAnimationContinuous).LoadPerCent = 0;
                        }
                    }
                }
            }
            StaticFreightWeight = inf.ReadSingle();
        }
    private void ResetPickup()
    {
        Anim.SetBool("Cycling", false);

        CurrentPickup = PickupType.None;
        GetComponent <BoxCollider2D>().enabled = true;
    }
Exemple #13
0
    public void SetPickup(PickupType Type)
    {
        if (CurrentPickup == PickupType.None) // If the player does not have a pickup
        {
            //Joey
            Running.SetActive(true);
            CurrentPickup = Type; // Then set the pickup

            switch (Type)         // And check which pickup it is, to set it's properties to the player
            {
            case PickupType.Bike:
                Anim.SetBool("Cycling", true);
                //Joey
                Running.SetActive(false);
                CantPickUp = true;
                break;

            case PickupType.ColaBottle:
                GlobalInitSpeed = Global.Instance.Speed;
                break;

            default: break;
            }
        }
    }
Exemple #14
0
        public void CreateRandomPickups()
        {
            foreach (Map map in TheLastSliceGame.MapManager.Maps)
            {
                int numPickups     = TheLastSliceGame.Random.Next(1, 1);
                int numIngredients = TheLastSliceGame.Random.Next(1, 1);

                for (int i = 0; i < numIngredients; i++)
                {
                    IngredientType type = (IngredientType)TheLastSliceGame.Random.Next(0, Enum.GetNames(typeof(IngredientType)).Length);

                    Vector2 cell = GetRandomValidCell(map);
                    if (!cell.Equals(Vector2.Zero))
                    {
                        map.AddEntity(EntityType.Ingredient, (int)cell.Y, (int)cell.X, type.ToString());
                    }
                }

                for (int i = 0; i < numPickups; i++)
                {
                    PickupType type = (PickupType)TheLastSliceGame.Random.Next(1, Enum.GetNames(typeof(PickupType)).Length);
                    Vector2    cell = GetRandomValidCell(map);
                    if (!cell.Equals(Vector2.Zero))
                    {
                        map.AddEntity(EntityType.Pickup, (int)cell.Y, (int)cell.X, type.ToString());
                    }
                }
            }
        }
    public void Reset()
    {
        mCurrentPickup = PickupType.NONE;
        mUpgradelevel  = 0;

        RemoveArmor();
    }
Exemple #16
0
    /*
     * // Handles picking something up
     */
    public void PickUp()
    {
        transform.FindChild("PickupSound").GetComponent <AudioSource>().Play();

        var amount = Enum.GetNames(typeof(PickupType)).Length;

        int t = Mathf.FloorToInt(UnityEngine.Random.Range(1, amount));

        _PickupText.text = Enum.GetName(typeof(PickupType), t);

        // Weapon pickup swaps between default weapon and other option
        if (_PickupText.text.Equals("Swap"))
        {
            if (_DefaultWeapon == WeaponType.Laser)
            {
                _PickupText.text = "Shotgun";
            }
            else
            {
                _PickupText.text = "Laser";
            }
        }

        _AvailablePickup = (PickupType)t;
        _HasPickup       = true;
    }
Exemple #17
0
    public void ShowItemPickup(ItemType itemType, PickupType pickupType)
    {
        if (PreviewItemParent == null)
        {
            return;
        }
        ItemData itemData = Database.Item.FindItem(itemType);

        if (itemData == null)
        {
            return;
        }
        SetDirection(new Vector2(0, -1));
        SetFrozen(true, true, true);

        m_PickingUpObject     = itemType;
        m_PickingUpObjectType = pickupType;

        m_PickupItem = (GameObject)Instantiate(itemData.Prefab);

        m_PickupItem.transform.parent        = PreviewItemParent;
        m_PickupItem.transform.localPosition = Vector2.zero;
        m_PickupItem.transform.localRotation = Quaternion.identity;

        MonoBehaviour[] components = m_PickupItem.GetComponentsInChildren <MonoBehaviour>();

        foreach (MonoBehaviour component in components)
        {
            component.enabled = false;
            //This disables literally every component in the item
        }
    }
        public void Initalise(GraphicsDevice graphicsDevice, PickupType type)
        {
            switch (type)
            {
            case PickupType.Health:
                texture2D   = content.Load <Texture2D>("Graphics/World/health pickup");
                appearDelay = 6.0f;

                break;

            case PickupType.Magic:
                texture2D   = content.Load <Texture2D>("Graphics/World/mana pickup");
                appearDelay = 5.0f;
                break;
            }

            p_type = type;
            r_type = RefillType.Neutral;

            InitialPosSet = false;

            position = Vector2.Zero;

            // Placing it above the window
            startingPosY = graphicsDevice.Viewport.Y - 100;
            position.Y   = startingPosY;

            bounds = new Rectangle(texture2D.Bounds.X, texture2D.Bounds.Y, texture2D.Width, texture2D.Height);

            appearTimer = 0.0f;

            fallSpeed = 200.0f;
        }
Exemple #19
0
    private void SetupLayoutGroup()
    {
        if (_layoutGroups.Count > 0)
        {
            for (int i = 0; i < _layoutGroups.Count; i++)
            {
                _layoutGroups[i].SetAlpha(1 - i * _alphaAmount);
            }

            _toolRequired          = _layoutGroups[0].GetRepairStageGroup().PickupType;
            _currentAmountItemDone = 0;
            _amountItemToDo        = _layoutGroups[0].GetRepairStageGroup().Amount;
        }
        //EVERYTHING IS DONE!
        else
        {
            _needRepair = false;
            if (RepairDoneEvent != null)
            {
                RepairDoneEvent(this);
            }

            JustGotWholeAgain();
        }
    }
Exemple #20
0
 /// <summary>
 /// Returns the fraction of diesel oil already in tank.
 /// </summary>
 /// <param name="pickupType">Pickup type</param>
 /// <returns>0.0 to 1.0. If type is unknown, returns 0.0</returns>
 public override float GetFilledFraction(PickupType pickupType)
 {
     if (pickupType == PickupType.FuelDiesel)
     {
         return(FuelController.CurrentValue);
     }
     return(0f);
 }
    private void ResetPickup()
    {
        GetComponent<BoxCollider2D>().enabled = true;

        Anim.SetBool("Cycling", false);

        CurrentPickup = PickupType.None;
    }
Exemple #22
0
    public GameObject SpawnPickup(Vector3 pos, PickupType pickupType = PickupType.Normal)
    {
        GameObject pickupPrefab = pickupType == PickupType.Normal ? _normalPickupPrefab : _bigScorePickupPrefab;
        GameObject pickup       = Instantiate(pickupPrefab, pos, Quaternion.identity);

        Utils.PickupObserver.Subscribe(pickup.GetComponent <Pickup>());
        return(pickup);
    }
Exemple #23
0
    private Vector3 NextRandomPosition(PickupType pickupType)
    {
        PickupSpawnZone spawnZone = pickupType == PickupType.Normal ? _normalPickupSpawnZone : _biggerScorePickupSpawnZone;
        float           x         = Random.Range(spawnZone.Zone.xMin, spawnZone.Zone.xMax);
        float           y         = Random.Range(spawnZone.Zone.yMin, spawnZone.Zone.yMax);

        return(new Vector3(x, y, -1));
    }
Exemple #24
0
 /// <summary>
 /// Entity Spawner 사용 시 등록때 설정 값
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="amount"></param>
 /// <param name="targetTags"></param>
 /// <param name="objs"></param>
 public virtual void Spawn(Entity entity, PickupType pickupType, int amount, List <string> targetTags, string[] objs = null)
 {
     this.entity     = entity;
     this.pickupType = pickupType;
     this.amount     = amount;
     this.targetTags = targetTags;
     this.objs       = objs;
 }
Exemple #25
0
 public void Init(Main main, PickupType pickupType)
 {
     this.main             = main;
     this.pickupType       = pickupType;
     this.pickupProperties = Pickup.pickupTypeToProperties[pickupType];
     gridSpacing           = main.GetGridSpacing();
     groundYPos            = (pickupProperties.scale.y / 2) - main.GetPlayerHeight() / 2;
 }
    void InstantiatePickup(Transform trans, GameObject prefab, PickupType type)
    {
        Vector3    spawnPos  = trans.position + (Vector3.up * 0.75f);
        GameObject newPickup = (GameObject)Instantiate(prefab, spawnPos, trans.rotation);

        newPickup.GetComponent <PickUpBase>().pickupType = type;
        NetworkServer.Spawn(newPickup);
    }
Exemple #27
0
 private void ActivatePowerup(PickupType type)
 {
     if (activePowerups == null)
     {
         activePowerups = new List <PickupType>();
     }
     activePowerups.Add(type);
 }
Exemple #28
0
    private IEnumerator NextSpawn(PickupType pickupType, float lifetimeS)
    {
        GameObject pickup = SpawnPickup(NextRandomPosition(pickupType), pickupType);

        yield return(new WaitForSeconds(lifetimeS));

        Destroy(pickup);
        yield break;
    }
	void OnTriggerEnter(Collider collider) {
		if(collider.tag == "Pickup") {
			tempPickup = collider.gameObject.GetComponent<PickupType>();
			inventory[tempPickup.pickupType] ++;
			Destroy(collider.gameObject);
			tempPickup = null;
			currentPickup++;
		}
	}
Exemple #30
0
 public PickupAble(int x, int y, int value, PickupType type) : base()
 {
     Type       = type;
     Value      = value;
     X          = x / Map.tileSize;
     Y          = y / Map.tileSize;
     position.X = x;
     position.Y = y;
 }
Exemple #31
0
    public void AddItem(ItemType itemType, int amount, PickupType pickupType)
    {
        Debug.Log("Code has reached AddItem, adding: " + itemType);
        if (amount > 0)
        {
            ItemData itemData = Database.Item.FindItem(itemType);
            Debug.Log(itemType + " is a " + itemData.name);
            if (itemData != null)
            {
                if (itemData.Animation != ItemData.PickupAnimation.None)
                {
                    m_MovementModel.ShowItemPickup(itemType, pickupType);
                }
                if (itemData.EquipOnPickup == true)
                {
                    Debug.Log("Enter the equipping zone with " + itemData.EquipableHand);
                    if (itemData.EquipableHand == ItemData.EquipPosition.SwordHand)
                    {
                        m_EquipModel.EquipWeapon(itemType);
                    }
                    else if (itemData.EquipableHand == ItemData.EquipPosition.ShieldHand)
                    {
                        m_EquipModel.EquipShield(itemType);
                    }
                    WeaponItem weapon = itemData.Item as WeaponItem;
                    EquipScreen.MyInstance.EquipWeapon(weapon);
                }
            }
            if (itemData.EquipOnPickup != true)
            {
                for (int i = 0; i < amount; i++) //this SHOULD call additem once for every amount you pick up
                {
                    Debug.Log("Inventory For loop reached");
                    if (itemType != ItemType.Money)
                    {
                        inventory.FindItemBeforeAdd(itemType);
                    }
                    if (itemType == ItemType.Money)
                    {
                        if (inventory.m_Items.ContainsKey(itemType) == true)
                        {
                            inventory.m_Items[itemType] += amount; //This will add one of the item as declared by the enum
                            Debug.Log("Adding money");
                        }
                        else
                        {
                            inventory.m_Items.Add(itemType, amount); //This will add the enum item to the dictionary if its not already there
                            Debug.Log("Adding money");
                            break;
                        }
                    }
                }
            }

            Debug.Log(amount + " " + itemType + " added");
        }
    }
Exemple #32
0
    public bool HaveCurrentTool(PickupType typeHolding)
    {
        if (_toolRequired == PickupType.NOTHING)
        {
            return(true);
        }

        return(typeHolding == _toolRequired);
    }
Exemple #33
0
	// Use this for initialization
	void Start () {
        m_SwapTimer = m_SwapChargeUpTime;

		m_UIManager = GameObject.FindGameObjectWithTag ("UIManager");
        m_Type = PickupType.empty;
        m_PlayerNumber = gameObject.GetComponent<CharacterController>().name;
		m_ID = gameObject.GetComponent<CharacterController>().m_PlayerNumber;
        m_ControllerType = gameObject.GetComponent<CharacterController>().m_ControllerType;
	}
    void Start ()
	{
	    _player          = GameObject.Find("Player").         GetComponent<Player>();
        _particleManager = GameObject.Find("ParticleManager").GetComponent<ParticleEffectsManager>();
	    _xForm           = transform;
        _pool            = GameObject.Find("GameManager").    GetComponent<GameManager>().BulletPool;
	    _weapons         = _player.                           GetComponent<Weapons>();
        CreatePath();
        pickupType = PickupType.BulletVel;
        SetPickupType();
	}
Exemple #35
0
        public static Pickup CreatePickup(Vector3 position, Model model, PickupType type)
        {
            model.Load();

            var retval = Internal.Function.Call<Pickup>(0x0213, model, (int)type, position);
            PickupHandler.Register(retval);

            model.Release();

            retval._origPos = position;
            return retval;
        }
Exemple #36
0
        public Pickup(PickupType type, Room room, Vector3 pos)
        {
            Type = type;
            Room = room;
            Position = pos;
            Rotation = (float)Helper.Random.NextDouble() * MathHelper.TwoPi;

            Active = true;

            switch (Type)
            {
                case PickupType.Health:
                    numFrames = 3;
                    frameOffset = 8;
                    break;
            }
        }
Exemple #37
0
        public Pickup(Vector2 inPos, PickupType p)
        {
            position = inPos;
            pickupType = p;

            collisionRadius = PlayerBuffs.tex.Width * 0.1f / Game1.graphics.GraphicsDevice.DisplayMode.Width;

            switch (pickupType)
            {
                case PickupType.missileAdd:
                    coreColor = Color.Green;
                    break;
                case PickupType.slowMo:
                    coreColor = Color.Red;
                    break;
                case PickupType.shieldAdd:
                    coreColor = Color.Blue;
                    break;
            }
        }
    public void SetPickup(PickupType Type)
    {
        if(CurrentPickup == PickupType.None) // If the player does not have a pickup
        {
            CurrentPickup = Type; // Then set the pickup

            switch(Type) // And check which pickup it is, to set it's properties to the player
            {
                case PickupType.Bike:
                    Anim.SetBool("Cycling", true);
                break;

                case PickupType.ColaBottle:
                    GlobalInitSpeed = Global.Instance.Speed;
                break;

                default: break;
            }
        }
    }
Exemple #39
0
    private void GeneratePickup()
    {
        int randIndex = Random.Range(0, 4);

        switch (randIndex)
        {
            case 0:
                currentPickupType = PickupType.Spread;
                break;
            case 1:
                currentPickupType = PickupType.Boomerang;
                break;
            case 2:
                currentPickupType = PickupType.Enlarge;
                break;
            case 3:
                currentPickupType = PickupType.Homing;
                break;
        }
        string pickupName = "Pickup_" + currentPickupType.ToString();

        gameObject.GetComponent<SpriteRenderer>().sprite = Resources.Load<Sprite>("Sprites/Pickups/" + pickupName);
    }
Exemple #40
0
 void RotateAll()
 {
     Rotate[] tempArray = GameObject.FindObjectsOfType<Rotate>();
     foreach (Rotate tempRotate in tempArray)
     {
         tempRotate.MakeRotate(1 * Mathf.Sign(Random.Range(-1, 1)));
     }
     m_Type = PickupType.empty;
 }
Exemple #41
0
	public void ChangePower(int ID, PickupType type)
	{
		m_UIImage [ID - 1].sprite = m_PowerUpSprites [(int)type];
	}
 public PickupProperties(PickupType type, float value)
 {
     this.type = type;
     this.value = value;
 }
Exemple #43
0
 void EmpowerBullet()
 {
     gameObject.GetComponent<CharacterFire>().empoweredType = 1;
     m_Type = PickupType.empty;
 }
 public void Spawn(PickupType type, Room room, Vector3 pos)
 {
     Pickups.Add(new Pickup(type, room, pos));
 }
Exemple #45
0
	void EnableTimeSlow(float time)
	{
		gameObject.GetComponent<CharacterController>().EnableTimeSlow(time);
		m_Type = PickupType.empty;
	}
	void Start() {
		inventory = new int[4];
		tempPickup = null;
	}
    private void ResetPickup()
    {
        Debug.Log("reset");
        GetComponent<BoxCollider2D>().enabled = true;

        Anim.SetBool("Cycling", false);

        CurrentPickup = PickupType.None;
        _colaPickupActive = false;
    }
Exemple #48
0
	void EnableReverseControls(float time)
	{
		//gameObject.GetComponent<CharacterFire> ().empoweredType = 2;

		///////////////DM: Below would just apply the debuff to all players other than the powerup user.(Tested and works)
		players = new GameObject[0];
		players = GameObject.FindGameObjectsWithTag("Player");
		m_PulseEmmiter.Play ();
		foreach (GameObject player in players)
		{
			if (player.GetComponent<CharacterController>().name!= m_PlayerNumber && Vector3.Distance(transform.position, player.transform.position)<m_PulseRange)
			{
				player.GetComponent<CharacterController>().EnableReverseControls(time);
			}
		}
		m_Type = PickupType.empty;
	}
Exemple #49
0
	public void ChangePickup(PickupType type)
	{
		m_Type = type;
		m_UIManager.GetComponent<UIPlayerDisplay> ().ChangePower (m_ID,type);
	}
Exemple #50
0
    bool SetSwapPlayers()
    {
        players = new GameObject[0];
        players = GameObject.FindGameObjectsWithTag("Player");


        m_CurrentPlayer = new GameObject();
        m_SwapPlayer = new GameObject();
        float tempHighest = 0.0f;

        for (int i = 0; i < players.Length; i++)
        {
            if (players[i].transform.position.y > tempHighest)
            {
                tempHighest = players[i].transform.position.y;
                m_SwapPlayer = players[i];
            }

            if (players[i].GetComponent<CharacterController>().name == m_PlayerNumber)
            {
                m_CurrentPlayer = players[i];
            }
        }

        if (m_CurrentPlayer == m_SwapPlayer)//Cant swap withself
        {
            return false;
        }
        else
        {
            m_Type = PickupType.empty;
            return true;
        }

    }