상속: MonoBehaviour
예제 #1
0
 public static PickupState FromPickupInstance(Pickup instance)
 {
     var state = new PickupState();
     state.Ammo = instance.Ammo;
     state.Name = instance.PickupName;
     return state;
 }
예제 #2
0
 void Start()
 {
     pickupScr = GameObject.Find("3D_SRH_001 (prefab v2)").GetComponent<Pickup>();
     guiScr = GameObject.Find("Menu").GetComponent<GuiScript>();
     canvasScr = GameObject.Find("Canvas (StartScene)").GetComponent<CanvasScript>();
     splashScreen.SetActive(false);
 }
 public void Awake()
 {
     pickupMover = GetComponentInParent<Pickup>();
     boxCollider = GetComponent<BoxCollider2D>();
     parentBody = GetComponentInParent<Rigidbody2D>();
     parentCollider = GetComponentInParent<BoxCollider2D>();
 }
예제 #4
0
    // Use this for initialization
    void Start()
    {
        flashlight = gameObject.GetComponentInChildren<Light>();

        maxBrightness = flashlight.intensity;

        pickupScript = GetComponent<Pickup>();
    }
예제 #5
0
 public static PickupState FromPrefab(Pickup prefab)
 {
     return new PickupState()
     {
         Name = prefab.PickupName,
         Ammo = prefab.Ammo
     };
 }
 public virtual IVehicle CreatePickup()
 {
     if (pickup == null)
     {
         pickup = new Pickup(new StandardEngine(1300));
     }
     return (IVehicle)pickup.Clone();
 }
예제 #7
0
    protected override void CopyStateToPickup(Pickup pickup)
    {
        var w = pickup as WeaponPickup;
        if (w == null) return;

        w.weaponType = WeaponType;
        w.ammo = AmmoLeft;
    }
	void FindObjects(){
		playerHpScr = GameObject.Find("testplayer").GetComponent<PlayerHpScript>();
		abilitySwitchScr = GameObject.Find("AbilitySwitch").GetComponent<AbilitySwitchScript>();
		manaScr = GameObject.Find("Mana Bar").GetComponent<ManaScript>();
		enemiesManagerScr = GameObject.Find("enemyManager").GetComponent<EnemiesManagerScript>();
		playerManagerScr = GameObject.Find("name").GetComponent<PlayerManager>();
		pickupScr = GameObject.Find("name").GetComponent<Pickup>();
	}
예제 #9
0
	void TakeItem(Pickup pickup) {
		if (this.itemPrefab == null) {
			this.itemPrefab = pickup.deployedItem;
		}

		this.offset = pickup.offsetFromPlayer;
		this.lifetime = pickup.lifetimeOnDeploy;
	}
예제 #10
0
    void Start()
    {
        pickupMover = GetComponent<Pickup>();
        curveMover = GetComponent<MoveAlongCurve>();

        pickupMover.enabled = false;
        collected = false;
    }
예제 #11
0
 public VehicleManager()
 {
     // For simplicity all vehicles use same engine type...
     saloon = new Saloon(new StandardEngine(1300));
     coupe = new Coupe(new StandardEngine(1300));
     sport = new Sport(new StandardEngine(1300));
     boxVan = new BoxVan(new StandardEngine(1300));
     pickup = new Pickup(new StandardEngine(1300));
 }
예제 #12
0
 // Called when the enemy bumps into the player.  It steals items then throws them away, gives the effect of dropping a bunch of items.
 private void BumpIntoEnemy(Transform player)
 {
     int r = Random.Range(2, maxStolenItems);
     for(int i = 0; i < r; i++)
     {
         enemyItem = inventory.Steal();//Inventory.Finder.StealItem();
         inventory.CreateItem(enemyItem, DropRange(player));//Inventory.Finder.InstantiateItem(enemyItem, DropRange(player));
     }
 }
 public Pickup Collided_Pickup(Rectangle playerRect)
 {
     foreach (Pickup p in GameState.objectManager.pickupsList)
     {
         if (p.Check_Collision(playerRect))
             currentPickup = p;
     }
     GameState.objectManager.pickupsList.Remove(currentPickup);
     return currentPickup;
 }
예제 #14
0
	// Update is called once per frame
	bool Search () {
        hats = GameObject.FindObjectsOfType<Pickup>();
        foreach (var item in hats) {
            if (item.EffectObject.Type == EffectType.AddEffect) {
                twirlHat = item;
                return true;
            }
        }
        return false;
	}
예제 #15
0
    protected override void CopyStateToPickup(Pickup p)
    {
        base.CopyStateToPickup(p);

        var wp = p as WeaponPickup;
        if (wp != null) {
            wp.weaponType = weaponType;
            wp.ammo = ammo;
        }
    }
예제 #16
0
    public void AddPickup(Pickup pickup)
    {
        Pickups.Add(pickup);
        RecalculateMass();

        if (!muteSounds && CollectPickupSounds.Length > 0)
        {
            var sound = CollectPickupSounds [Random.Range(0, CollectPickupSounds.Length)];
            Helper.PlaySoundEffect(sound);
        }
    }
예제 #17
0
    public void Initialize(Pickup p)
    {
        if (p == null)
            pickup = new Pickup();
        else
        {
            pickup = p;
        }

        SetImage();
    }
예제 #18
0
    private static bool RomanCollision(RomanMovement m1, Pickup p1, RomanMovement m2, Pickup p2)
    {
        if( p1.IsBeingThrown == false && p2.IsBeingThrown == true ) {
            var dir = (p2.ThrowingDirection.normalized + (m1.pos - m2.pos)).normalized * p2.ThrowingDirection.magnitude;
            p1.Throw(p2.SuggestedThrowingTimer, dir);
            // Debug.Log("Collision");
            return true;
        }

        return false;
    }
예제 #19
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if(other.CompareTag("Player"))
     {
         // Bumped into the player, make player drop some of it's inventory.
         // Steal an item then thow them out right away into the immediate vacinity.
         for(int i = 0; i < maxStolenItems; i++)
         {
             enemyItem = inventory.Steal();//Inventory.Finder.StealItem();
             inventory.CreateItem(enemyItem, DropRange(other.gameObject.transform)); //Inventory.Finder.InstantiateItem(enemyItem, DropRange(other.gameObject.transform));
         }
     }
 }
예제 #20
0
파일: Program.cs 프로젝트: ktjones/BVCS2012
        static void Main(string[] args)
        {
            PassengerTrain ptrain = new PassengerTrain();
            Compact cpact = new Compact();
            SUV suv = new SUV();
            Pickup pickup = new Pickup();

            AddPassenger(ptrain);
            AddPassenger(cpact);
            AddPassenger(suv);
            AddPassenger(pickup);

            Console.ReadKey();
        }
예제 #21
0
 public bool IsSlotAvailable(int slot, Pickup item)
 {
     Image image = imageArray[slot];
     if (1f != image.color.a || Pickup.PowerupType.Greed == item.Powerup)
     {
     //			Debug.Log ("slot " + slot + " available");
         EnableSlot(image);
         return true;
     }
     else
     {
         Debug.Log ("slot " + slot + " occupied");
         return false;
     }
 }
예제 #22
0
  public void AddPickup(Pickup pickup)
  {
    IsPickup = true;

    var renderer = AddSprite(pickup.Sprite);
    Action = () =>
    {
      IsPickup = false;
      GameStatus.Root.SoundPlayer.Play(pickup.Sound);
      GameStatus.Score += pickup.Score;
      renderer.enabled = false;
    };

    name = pickup.Name;
  }
예제 #23
0
 public bool IsSlotAvailable(int slot, Pickup item)
 {
     Image image = imageArray[slot];
     if (enabledAlpha != image.color.a)
     {
         Debug.Log ("slot " + slot + " available");
         EnableSlot(slot);
         return true;
     }
     else
     {
         Debug.Log ("slot " + slot + " occupied");
         return false;
     }
 }
예제 #24
0
    private bool IsPickupActivated(Pickup pickup)
    {
        if (pickup.GetType () == typeof(MultiplierPickup))
            return GameData.gameData.playerData.talent.leaf > 0 ? true : false;

        if (pickup.GetType () == typeof(HealPickup))
            return GameData.gameData.playerData.talent.heal > 0 ? true : false;

        if (pickup.GetType () == typeof(CloudPickup))
            return GameData.gameData.playerData.talent.cloud > 0 ? true : false;

        if (pickup.GetType () == typeof(LastWishPickup))
            return GameData.gameData.playerData.talent.lastWish > 0 ? true : false;

        return true;
    }
예제 #25
0
 void Update()
 {
     if (spawned) {
         if (!spawnedPickup) {
             spawned = false;
             nextSpawnTime = Time.fixedTime + spawnInterval;
         }
     } else {
         if (Time.fixedTime >= nextSpawnTime && pickupPrefab) {
             var pos = transform.position;
             var rot = transform.rotation;
             spawnedPickup = (Pickup) Instantiate(pickupPrefab, pos, rot);
             CopyStateToPickup(spawnedPickup);
             spawned = true;
         }
     }
 }
        public override string ToString()
        {
            pick = (Pickup)base.Tag;

            Binding myBinding = new Binding("channels");
            myBinding.Mode = BindingMode.TwoWay;
            myBinding.Source = pick;
            txtexten.SetBinding(TextBox.TextProperty, myBinding);

            Binding descbinding = new Binding("Description");
            descbinding.Mode = BindingMode.TwoWay;
            descbinding.Source = pick;
            txtdesc.SetBinding(TextBox.TextProperty, descbinding);


            return base.ToString();
        }
예제 #27
0
	public void GetPickup(Pickup pickup) {
		pickup.gameObject.transform.parent = this.transform;
		pickup.transform.localPosition = Vector3.zero;

		if (pickup.IsEquippable()) {
			if (currentPickup != null) {
				currentPickup.OnDrop();
				GameObject.Destroy(currentPickup.gameObject);
			}
			currentPickup = pickup;
			equippedItem = EquipType.SUB_WEAPON;
			spaceship.DisableGun();
		}
			
		pickup.OnPickup(this.spaceship);
		pickup.gameObject.SetActive(true);
	}
        public ActionResult ConfirmPickup([Bind(Include = "Id,RegularPickupDay,PickupConfirmed,ExtraPickupDay,ExtraPickupConfirmed,TemporarySuspensionStart,TemporarySuspensionEnd")] Pickup pickup)
        {
            if (ModelState.IsValid)
            {
                db.Entry(pickup).State = EntityState.Modified;
                if (pickup.PickupConfirmed == true)
                {
                    pickup.Bill += 20;
                }
                if (pickup.ExtraPickupConfirmed == true)
                {
                    pickup.Bill += 20;
                }
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            return(View(pickup));
        }
예제 #29
0
    private void CmdPickupItem(GameObject t)
    {
        int    id        = 0;
        Pickup component = t.GetComponent <Pickup>();

        if (component != null)
        {
            id = component.id;
            component.PickupItem();
        }
        Locker component2 = t.GetComponent <Locker>();

        if (component2 != null)
        {
            id = component2.GetItem();
            component2.SetTaken(true);
        }
        this.AddItem(id, (!(t.GetComponent <Pickup>() == null)) ? component.durability : -1f);
    }
예제 #30
0
    private void OnTriggerEnter(Collider col)
    {
        if ((1 << col.gameObject.layer & ShellTriggerLayer) != 0)
        {
            Debug.Log("OnTrigger Enter");
            isNearShell  = true;
            nearestShell = col.GetComponent <ShellEntrance>();
        }

        if ((1 << col.gameObject.layer & PickUpTriggerLayer) != 0 && nearestPickup == null)
        {
            nearestPickup = col.GetComponent <Pickup>();
        }

        if ((1 << col.gameObject.layer & CrabTriggerLayer) != 0)
        {
            nearestCrab = col.GetComponent <Crab>();
        }
    }
 public void PoolAPickup(Pickup pickup)
 {
     if (pickup.isInScene)
     {
         if (!PooledPickups.Contains(pickup))
         {
             PooledPickups.Add(pickup);
             Debug.Log("pooled");
         }
         else
         {
             Debug.LogError("Attempting to pool object that already exists in pool: " + pickup);
         }
     }
     else
     {
         Debug.LogError("Attempting to pool object that does not exist in scene: " + pickup);
     }
 }
예제 #32
0
        // GET: Pickups/Create
        public IActionResult Create(int restaurantId)
        {
            var pickup = new Pickup();

            pickup.Date = DateTime.Today;
            var rest = _repo.restaurants.Get(restaurantId);

            if (rest == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            pickup.RestaurantId = rest.Id;
            pickup.Restaurant   = rest;
            pickup.PickupTime   = DateTime.Parse(DateTime.Today.ToString("yyyy-MM-dd 12:00"));
            var userid = _userManager.GetUserId(User);

            LoadPickUpUserList(userid);
            return(View(pickup));
        }
예제 #33
0
    public void UpdateUi()
    {
        ClearItems();
        string[] names = player.GetInventoryItemNames();

        for (int i = 0; i < names.Length; i++)
        {
            Pickup     pi = GameManager.Instance.GetPickupWithName(names[i]);
            GameObject go = Instantiate(invSlot, transform);
            go.GetComponent <InventorySlot>().SetItemName(pi.itemName);

            if (pi.itemDiscription != null)
            {
                go.GetComponent <InventorySlot>().SetItemDiscription(pi.itemDiscription);
            }

            go.GetComponent <Image>().sprite = pi.itemSprite;
        }
    }
예제 #34
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        DamageDealer projectile = collider.gameObject.GetComponent <DamageDealer>();
        Enemy        enemy      = collider.gameObject.GetComponent <Enemy>();
        Pickup       pickup     = collider.gameObject.GetComponent <Pickup>();

        if (projectile)
        {
            ProcessHit(projectile, enemy);
        }
        else if (pickup)
        {
            pickupProcessor.Process(pickup);
        }
        else
        {
            return;
        }
    }
예제 #35
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.name.ToLower().Contains("pass"))
        {
            return;
        }
        if (other.name.Contains("Fireball"))
        {
            other.GetComponent <FireballScript>().SelfDestruct();
            SelfDestruct();
            return;
        }

        var playerController = other.GetComponent <PlayerController>();

        if (playerController != null)
        {
            if (!(canDamageSelf && playerController == owner))
            {
                playerController.Damage(damage);
                SelfDestruct();
            }
            return;
        }
        Pickup Pickup = other.transform.GetComponent <Pickup>();

        if (Pickup != null)
        {
            return;
        }

        if (other.gameObject.GetComponent <LightningScript>() != null)
        {
            return;
        }

        if (other.gameObject.GetComponent <CrownScript>() != null)
        {
            return;
        }

        SelfDestruct();
    }
 public ActionResult CreateSinglePickup(Pickup pickup)
 {
     try
     {
         var userId   = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
         var customer = _db.Customers.Where(c => c.IdentityUserId == userId).SingleOrDefault();
         pickup.CustomerId    = customer.Id;
         pickup.PickupZipCode = customer.ZipCode;
         pickup.IsActive      = true;
         pickup.IsOneOff      = true;
         _db.Pickups.Add(pickup);
         _db.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     catch (Exception e)
     {
         return(View());
     }
 }
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "TaskLocation")
     {
         TaskLocation location = other.GetComponent <TaskLocation>();
         if (location != null)
         {
             _currentLocation = location;
         }
     }
     else if (other.tag == "Pickup")
     {
         _currentPickup = other.GetComponent <Pickup>();
     }
     else if (other.tag == "PickupBox")
     {
         _consumeBox = other.GetComponent <ConsumeBox>();
     }
 }
예제 #38
0
    private void DropWeapon()
    {
        if (Weapon != null)
        {
            Pickup pToMatch = Weapon.damagerSO.pickup.GetComponent <Pickup>();
            Pickup p        = pToMatch.pool.TakePooledPickup(pToMatch);
            if (p)
            {
                p.transform.position = DropPos;
            }
            else
            {
                GameObject.Instantiate(Weapon.damagerSO.pickup, DropPos, Quaternion.identity);
            }

            Weapon.gameObject.SetActive(false);
        }
        Weapon = null;
    }
예제 #39
0
    private void OnTriggerEnter(Collider collider)   // This method automatically gets called when the object it is on enters a collider (Set to trigger)
    {
        // Sanity check.
        if (collider == null)
        {
            return;
        }

        // Check to see if the collider game object has a Pickup component.
        Pickup pickup = collider.gameObject.GetComponent <Pickup>();

        if (pickup != null)
        {
            this.score += pickup.scoreValue;

            // Destroy the pickup.
            Destroy(collider.gameObject);
        }
    }
        public ActionResult CreatePickup()
        {
            string                identityUserId = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
            IEnumerable <Day>     days           = _context.Days;
            IEnumerable <Address> addresses      = _context.Addresses.Where(a => a.Customer_Id == _context.Customers.FirstOrDefault(c => c.IdentityUser_Id == identityUserId).Id);

            foreach (Address address in addresses)
            {
                address.Single_Line_Address = address.Street_Number_and_Name + ", " + address.City + ", " + _context.USStates.FirstOrDefault(s => s.Id == address.USStateId).Name + ", " + address.Zip_Code;
            }
            Pickup pickup = new Pickup()
            {
                Address   = _context.Addresses.FirstOrDefault(a => a.Customer.IdentityUser_Id == this.User.FindFirstValue(ClaimTypes.NameIdentifier)),
                Days      = days,
                Addresses = addresses
            };

            return(View(pickup));
        }
예제 #41
0
    private void HandlePickup(Pickup p)
    {
        switch (p.pickupType)
        {
        case Pickup.PickupType.Health:
            if (AddPickupValue(p.strength, p.maxVal, ref health))
            {
                p.DoPickup();
                faceManager.UpdateFace(health);
            }
            break;

        case Pickup.PickupType.Armour:
            if (AddPickupValue(p.strength, p.maxVal, ref armour))
            {
                p.DoPickup();
            }
            break;

        case Pickup.PickupType.Ammo:
            WeaponManager.WeaponType wt = weaponManager.WeaponTypeFromString(p.target);
            int ammo = weaponManager.GetAmmo(wt.ammoType);
            if (p.maxVal == -1)
            {
                ammo += p.strength;
            }
            else
            {
                AddPickupValue(p.strength, p.maxVal, ref ammo);
            }

            weaponManager.SetAmmo(p.target, ammo);
            if (wt.state == WeaponManager.WeaponType.State.Missing && p.toggle)
            {
                weaponManager.ObtainWeapon(p.target, (WeaponManager.WeaponType.State.Normal));
                weaponManager.SetSelectedWeapon(p.target);
            }
            p.DoPickup();

            break;
        }
        UpdateGUIStats();
    }
예제 #42
0
    public void OnDetectedPickup(Pickup detectedPickup)
    {
        var pos = transform.position;

        if (!closestPickup) {
            // No need to check distances
            closestPickup = detectedPickup;
        } else {
            // Calculate distance to current closest Pickup to detected Pickup
            var pickupPos = closestPickup.transform.position;
            var currentDistance = Vector3.Distance(pos, pickupPos);
            var newDistance = Vector3.Distance(pos, pickupPos);

            // Choose new Pickup if it's closer
            if (newDistance < currentDistance) {
                closestPickup = detectedPickup;
            }
        }
    }
예제 #43
0
 public void TryFix(Pickup item)
 {
     if (!item.HasNameDiscovered())
     {
         GameNotificationHandler.SendGameNotification(item.GameNotificationData());
     }
     if (item.CheckType() == correctItem)
     {
         SoundManager.PlayEvent(AKID.EVENTS.ITEM_PORT_POSITIVE, gameObject);
         ambientFixedEvent.Post(gameObject);
         ambientBrokenEvent.Stop(gameObject, 100);
         Fix();
     }
     else
     {
         SoundManager.PlayEvent(AKID.EVENTS.ITEM_PORT_NEGATIVE, gameObject);
         BreakOtherRooms();
     }
 }
예제 #44
0
        public ActionResult SetUpWeeklyPickUp(Customer customer)
        {
            ApplicationDbContext db = new ApplicationDbContext();
            Pickup pickup;

            if (customer.PickupId == null)
            {
                pickup = new Pickup();
                DateTime?date = customer.Schedule;
                pickup.WeekOne   = date;
                pickup.WeekTwo   = date.Value.AddDays(7);
                pickup.WeekThree = date.Value.AddDays(14);
                pickup.WeekFour  = date.Value.AddDays(21);
                db.Pickup.Add(pickup);
                customer.PickupId        = pickup.Id;
                db.Entry(customer).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", "Customer", new { id = customer.Id }));
            }
            else if (customer.PickupId != null)
            {
                if (customer.Start != null)
                {
                    customer.Start = null;
                    customer.End   = null;
                }
                int?pickUpId = customer.PickupId;
                pickup = db.Pickup.Find(pickUpId);
                DateTime?date = customer.Schedule;
                pickup.WeekOne           = date;
                pickup.WeekTwo           = date.Value.AddDays(7);
                pickup.WeekThree         = date.Value.AddDays(14);
                pickup.WeekFour          = date.Value.AddDays(21);
                db.Entry(pickup).State   = EntityState.Modified;
                db.Entry(customer).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", "Customer", new { id = customer.Id }));
            }
            else
            {
                return(RedirectToAction("EditPickUp", "Customer", customer));
            }
        }
예제 #45
0
        public static void InvokePickupItem(GameObject player, ref Pickup item, ref bool allow)
        {
            PickupItem pickupItem = PickupItemEvent;

            if (pickupItem == null)
            {
                return;
            }
            PickupItemEvent ev = new PickupItemEvent()
            {
                Player = Player.GetPlayer(player),
                Item   = item,
                Allow  = allow
            };

            pickupItem.Invoke(ref ev);
            allow = ev.Allow;
            item  = ev.Item;
        }
예제 #46
0
        public async Task <IActionResult> Create(Pickup newpickup)
        {
            if (ModelState.IsValid)
            {
                _context.Add(newpickup);
                await _context.SaveChangesAsync();

                if (Request.Form["sendSlack"] == "on")
                {
                    var pickup = _repo.pickups.Get(newpickup.Id);
                    var msg    = string.Concat(pickup.PickupUser.NicknameOrUser, " is heading to ",
                                               pickup.Restaurant.Name, " at ", pickup.PickupTime.ToString("HH:mm tt"), ". Get your orders in!");
                    var success = await PostToSlack(newpickup.Id, "New Pickup", msg);
                }
                return(RedirectToAction(nameof(Details), new { id = newpickup.Id }));
            }
            LoadPickUpUserList(newpickup.PickupUserId);
            return(View(newpickup));
        }
예제 #47
0
        private IEnumerator <float> ThrowWhenRigidbody(Pickup pickup, Vector3 dir)
        {
            Log.Debug("Starting the coroutine, waiting until the thrown Pickup has a RigidBody (has physics).");

            yield return(MEC.Timing.WaitUntilFalse(() => pickup != null && pickup.Rb == null));            // mom im scared of loops

            Log.Debug($"Rigidbody instantiated. Translating its position to {Config.initialPosVec3}, then throwing with a force of {dir * Config.ThrowForce}.");

            // Wrap this part in a try-catch if it's compiled as DEBUG
            try
            {
                pickup.Rb.transform.Translate(Config.initialPosVec3, Space.Self);
                pickup.Rb.AddForce(dir * Config.ThrowForce, ForceMode.Impulse);
                Vector3 rand = new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), Random.Range(-100f, 1f)).normalized;
                pickup.Rb.angularVelocity = rand.normalized * Config.RandomSpinForce;
            } catch (System.Exception ex) {
                Log.Error("ThrowItems thrown an exception in its \"throw\" coroutine:\n" + ex);
            }
        }
예제 #48
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        DamageDealer damageDealer = collision.gameObject.GetComponent <DamageDealer>();

        if (!damageDealer)
        {
            Pickup pickup = collision.gameObject.GetComponent <Pickup>();

            if (!pickup)
            {
                return;
            }

            ProcessPickup(pickup);
            return;
        }

        ProcessHit(damageDealer);
    }
예제 #49
0
        public ActionResult Create(Pickup pickup, Customer customer)
        {
            if (ModelState.IsValid)
            {
                var loggedUser = User.Identity.GetUserId();
                var customers  = db.Customer.Single(c => c.UserID == loggedUser);

                customers.PickupID        = customer.PickupID;
                db.Entry(customers).State = EntityState.Modified;
                db.SaveChanges();

                //db.Pickup.Add(pickup);
                //db.SaveChanges();
                return(RedirectToAction("Index", "Customers"));
            }

            ViewBag.PickupId = new SelectList(db.Pickup, "ID", "Day", customer.PickupID);
            return(View(pickup));
        }
예제 #50
0
    public static Pickup SpawnPickup(Item item, Vector3 position, Quaternion rotation)
    {
        Pickup thePickup = null;

        if (item.specialPrefab == null)
        {
            thePickup = Instantiate(Global.pickupPrefab);
        }
        else
        {
            thePickup = Instantiate(item.specialPrefab);
        }
        thePickup.takeToInventory    = true;
        thePickup.pickupItem         = Instantiate(item);
        thePickup.transform.position = position;
        thePickup.transform.rotation = Quaternion.identity;
        Destroy(item);
        return(thePickup);
    }
예제 #51
0
        internal void SpawnScp012Item()
        {
            Scp012Item = Item.Spawn(ItemType.KeycardO5, 0, itemSpawnPos, itemRotation);
            GameObject gameObject = Scp012Item.gameObject;

            Log.Debug($"Item pos: {itemSpawnPos}", Config.Debug);

            NetworkServer.UnSpawn(gameObject);

            gameObject.transform.localScale = new Vector3(0.01f, 175f, 15f);

            var rigidbody = gameObject.GetComponent <Rigidbody>();

            rigidbody.isKinematic = true;

            NetworkServer.Spawn(gameObject);

            Log.Debug("SCP-012 item spawned successfully!", Config.Debug);
        }
예제 #52
0
        internal void OnPickupSet(Pickup pickup)
        {
            if (_pickupSetHook == null)
            {
                return;
            }

            foreach (Delegate toInvoke in _pickupSetHook.GetInvocationList())
            {
                try
                {
                    toInvoke.DynamicInvoke(pickup);
                }
                catch (Exception e)
                {
                    Logger.LogError($"[{GetModNameFromDelegate(toInvoke)}] Error running PickupCreated\n{e}");
                }
            }
        }
예제 #53
0
    private void OnTriggerEnter2D(Collider2D collider)
    {
        if (!alive)
        {
            return;
        }

        Pickup pu = collider.GetComponent <Pickup>();

        if (pu != null)
        {
            if (on_pickup != null)
            {
                on_pickup(pu);
            }
            power = pu.power;
            camshake.Shake(CamShakeType.Strong);
        }
    }
예제 #54
0
    public Save(Chunk chunk)
    {
        Debug.Log ("saveattempt blocks");
        //pull our block data from chunk and store it in dictionary only if changed
        for (int x = 0; x < Chunk.chunkSize; x++)
        {
            for (int y = 0; y < Chunk.chunkSize; y++)
            {
                for (int z = 0; z < Chunk.chunkSize; z++)
                {
                    if (chunk.blocks[x, y, z].changed) //if this block was changed, lets save the block and related articles
                    {
                        WorldPos pos = new WorldPos(x, y, z);
                        blocks.Add(pos, chunk.blocks[x, y, z]);
                    }
                }
            }
        }
        //pickup blocks should always be saved
        GameObject[] drops;
        drops = GameObject.FindGameObjectsWithTag("pickup");
        if(drops.Length > 0) {
            Debug.Log ("saveattempt pickups");
            Rect rbounds = new Rect(chunk.pos.x, chunk.pos.y, Chunk.chunkSize, Chunk.chunkSize);
            foreach (GameObject pickupObj in drops)
            {

                if(rbounds.Contains(pickupObj.transform.position, true) )
                {

                        //Debug.Log ("saveattempt single pickup");

                    //set position within the data structure before saving
                    Pickup thisPickup = new Pickup();
                    thisPickup.copyPickup(pickupObj.GetComponent<pickUpScript>().pickup);

                    thisPickup.setPosition(pickupObj.transform.position, pickupObj.transform.rotation);

                    articles.Add(thisPickup.getWorldPos(), thisPickup);
                }
            }
        }
    }
예제 #55
0
 void Update()
 {
     if (Input.GetButtonDown("Fire1") || Input.GetButtonDown("Fire2"))
     {
         if (!holdingItem)
         {
             RaycastHit hitInfo;
             // Raycast from the center of the screen two units forward
             if (Physics.Raycast(Camera.main.transform.position, Camera.main.transform.forward, out hitInfo, 2))
             {
                 Pickup pickup = hitInfo.transform.GetComponentInParent <Pickup> ();
                 if (pickup != null)
                 {
                     GameObject pickupObj = pickup.GrabPickup();
                     if (pickupObj != null)
                     {
                         heldObject  = GameObject.Instantiate(pickupObj, pickupSpawn);
                         holdingItem = true;
                     }
                 }
             }
         }
         else
         {
             heldObject.transform.parent = null;
             heldObject.GetComponent <Collider> ().enabled = true;
             Rigidbody heldRB = heldObject.GetComponent <Rigidbody> ();
             heldRB.isKinematic = false;
             Vector3 forward  = heldRB.transform.forward;
             Vector3 throwDir = new Vector3(forward.x, forward.y + .4f, forward.z);
             if (Input.GetButtonDown("Fire1"))
             {
                 heldRB.AddForce(throwDir * 500);
             }
             else if (Input.GetButtonDown("Fire2"))
             {
                 heldRB.AddForce(throwDir * 150);
             }
             holdingItem = false;
         }
     }
 }
예제 #56
0
        /// <summary>
        /// Ryan Spurgetis
        /// 4/29/2017
        ///
        /// Retrieves pickup based on the pickupId field
        /// </summary>
        /// <remarks>
        /// Robert Forbes
        ///
        /// Updated:
        /// 2017/04/30
        ///
        /// Added Company order id to database table so had to update all accessors
        /// </remarks>
        /// <param name="pickupId"></param>
        /// <returns></returns>
        public static Pickup RetrievePickupById(int?pickupId)
        {
            Pickup pickup = null;

            var conn    = DBConnection.GetConnection();
            var cmdText = @"sp_retrieve_pickup";
            var cmd     = new SqlCommand(cmdText, conn);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@PICKUP_ID", pickupId);

            try
            {
                conn.Open();
                var reader = cmd.ExecuteReader();

                if (reader.HasRows)
                {
                    reader.Read();
                    pickup = new Pickup()
                    {
                        PickupId       = reader.GetInt32(0),
                        SupplierId     = reader.GetInt32(1),
                        WarehouseId    = reader.GetInt32(2),
                        DriverId       = reader.GetInt32(3),
                        EmployeeId     = reader.GetInt32(4),
                        CompanyOrderId = reader.GetInt32(5)
                    };
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }

            return(pickup);
        }
예제 #57
0
        private void PickUp(Pickup pickup)
        {
            if (IsDead)
            {
                return;
            }

            if (pickup)
            {
                switch (pickup.PickupInfo.Type)
                {
                case ItemType.Ammo:
                {
                    m_CurrentPopcornBags += (int)pickup.PickupInfo.Amount;

                    PlayPickupSound(pickup);

                    Destroy(pickup.gameObject);
                    break;
                }

                case ItemType.Health:
                {
                    if (CurrentHPPercentage < 1)
                    {
                        Heal(pickup.PickupInfo.Amount);

                        PlayPickupSound(pickup);

                        Destroy(pickup.gameObject);
                    }
                    break;
                }
                }
            }
#if CUSTOM_DEBUG_MESSAGES
            else
            {
                Debug.Log("Pickup was null!", this);
            }
#endif
        }
예제 #58
0
    private void Update()
    {
        float h = Input.GetAxis("Horizontal");
        float v = Input.GetAxis("Vertical");

        if (h > 0.5f)
        {
            dirEnum = Direction.RIGHT;
        }
        else if (h < -0.5f)
        {
            dirEnum = Direction.LEFT;
        }

        if (v > 0.5f)
        {
            dirEnum = Direction.UP;
        }
        else if (v < -0.5f)
        {
            dirEnum = Direction.DOWN;
        }

        Vector2 rayDir = GetDirection();

        RaycastHit2D rayHit = Physics2D.Raycast(playerTransform.position, rayDir * 2f);

        if (rayHit.collider == null)
        {
            return;
        }
        if (rayHit.collider.tag == "Pickup")
        {
            if (Input.GetKeyDown(KeyCode.C))
            {
                Pickup pickup = rayHit.collider.GetComponent <Pickup>();

                SetKey(pickup);
                Destroy(pickup.gameObject);
            }
        }
    }
예제 #59
0
    public void AddItemToInventory(GameObject item)
    {
        // First, let's make sure it's an actual weapon
        Pickup pickup = item.GetComponent <Pickup>();

        if (pickup != null)
        {
            // Now, let's see if we can just put it in without swapping
            if (SlotIsFree(pickup.pickupSlot))
            {
                // Slot is free, we can just put it in the inventory
                for (int i = 0; i < inventoryItems.Count; i++)
                {
                    if (inventoryItems [i].slotType == pickup.pickupSlot)
                    {
                        if (inventoryItems [i].item == null)
                        {
                            AddToSlot(i, item);

                            break;
                        }
                    }
                }
            }
            else
            {
                // We have to swap it with an item already there
                for (int i = 0; i < inventoryItems.Count; i++)
                {
                    if (inventoryItems [i].slotType == pickup.pickupSlot)
                    {
                        EquipInventoryItem(inventoryItems [i].item);
                        DropCurrentItem(true);

                        AddToSlot(i, item);
                    }
                }
            }
        }
        SetPrefs();
        AfterInventorySlotChanged();
    }
예제 #60
0
	public override void Update () {
		if (currentPickup != null && currentPickup.ShouldDrop()) {
			currentPickup.OnDrop();
			GameObject.Destroy(currentPickup.gameObject);
			currentPickup = null;
			equippedItem = EquipType.DEFAULT_WEAPON;
			spaceship.EnableGun();
		}

		if (NetworkManager.IsSinglePlayer() || networkView.isMine) {

			/* Swap guns if hitting bumpers. */
			if (swappingWeapon) {
				SwapEquippedItem();
				if (!NetworkManager.IsSinglePlayer()) {
					networkView.RPC("NetworkSwapEquippedItem", RPCMode.OthersBuffered);
				}				
			}
		}
	}