//otrzymuje przedmiot do uzycia w prawej rece public void StartUsingItem(SceneItem anItem) { if (anItem != UsedItem && (UsedItem == null || anItem == null || UsedItem.Type != anItem.Type)) { if (UsedItem != null) { PrefabPool.Instance.ReleasePrefab(UsedItem.gameObject); } if (anItem == null) { ActivateHands(null); } else if (anItem.GetComponent <SceneWeapon>() != null) { ActivateHands((string)anItem.GetComponent <SceneWeapon>().WeaponData["fppHands"]); } if (anItem != null) { anItem.transform.parent = _internalPivot.transform; anItem.transform.localPosition = Vector3.zero; anItem.transform.localRotation = Quaternion.identity; anItem.transform.localScale = Vector3.one; } UsedItem = anItem; } }
//Dodaje przedmiot do plecaka na pierwsze wolne miejsce albo na miejsce _wybranyPanel jesli brak wolnych miejsc public void Add(SceneItem addedItem) { ItemDataAddon newItem = (ItemDataAddon)addedItem.GetComponent <PrefabTemplate>().DataObjects.GetDataAddon("items"); FPPGameModuleManager.Instance.TheInventory.Add(newItem); ActiveObjectsManager.Instance.RemoveActiveObject(addedItem.GetComponent <ActiveObject>()); addedItem.StartPickingUp(); RefreshAll(); }
public bool Body_OnCollision(Fixture fixtureA, Fixture fixtureB, FarseerPhysics.Dynamics.Contacts.Contact contact) { SceneItem dataA = ((SceneItem)fixtureA.Body.UserData); SceneItem dataB = ((SceneItem)fixtureB.Body.UserData); if (HaveTheseCollided(dataA, dataB)) { return(false); } CollisionComponent collisionComponentA = dataA.GetComponent <CollisionComponent>(); CollisionComponent collisionComponentB = dataB.GetComponent <CollisionComponent>(); if (collisionComponentA != null) { CollisionEventArgs eventArgs = new CollisionEventArgs(); eventArgs.CollidedSceneItemA = dataB; eventArgs.CollidedSceneItemB = dataA; collisionComponentA.OnCollision(eventArgs); } if (collisionComponentB != null) { CollisionEventArgs eventArgs = new CollisionEventArgs(); eventArgs.CollidedSceneItemA = dataA; eventArgs.CollidedSceneItemB = dataB; collisionComponentB.OnCollision(eventArgs); } OnScreenStats.AddStat(string.Format("BODY! {0} {1}", dataA.Name, dataB.Name)); return(false); }
public void UpdateView(Transform view, SceneItem data) { if (data == null) { // reset view var childImages = view.GetComponentsInChildren <Image>(); foreach (var tmp in childImages) { tmp.enabled = false; tmp.sprite = null; } return; } var images = view.GetComponentsInChildren <Image>(); foreach (var image in images) { image.enabled = true; } var imageComponent = images.Last(); // find sprite to display Sprite silhouette = data.Silhouette; if (silhouette == null) { silhouette = data.GetComponent <SpriteRenderer>().sprite; } // set sprite imageComponent.sprite = silhouette; Resize(view, imageComponent, silhouette); }