public void Init() { rigidbody2D = this.gameObject.GetComponent <Rigidbody2D>(); if (rigidbody2D == null) { rigidbody2D = this.gameObject.AddComponent <Rigidbody2D>(); } clothesController = this.gameObject.GetComponent <ClothesController>(); if (clothesController == null) { clothesController = this.gameObject.AddComponent <ClothesController>(); } clothesController.Init(); //NOT CHANGEABLE clothesController.SetClothes(ClothesHolder.SKIN_INDEX, Random.Range(0, Game.Instance.cClothes.dictTypeList[ClothesHolder.SKIN_INDEX].Count) % Game.Instance.cClothes.dictTypeList[ClothesHolder.SKIN_INDEX].Count, Color.red); animator = this.gameObject.GetComponent <Animator>(); }
private void Start() { this.dropController = FindObjectOfType <ClothesController>(); }
private void Start() { this.dropController = GetComponent <ClothesController>(); }
public ClothesControllerTests() { _mockClothesService = new Mock <IClothesService>(); _clothesController = new ClothesController(_mockClothesService.Object); }
protected virtual void OnInputUpdate(InputActionEventData iData) { if (!iData.GetButtonUp()) { return; } int iClothesType = -1; data.iSuspicion = 0; if (iData.actionId == RewiredConsts.Action.HatSwap || iData.actionId == RewiredConsts.Action.BodySwap || iData.actionId == RewiredConsts.Action.LegSwap ) { foreach (NPCController interactable in interactables) { if (interactable.IsPlayerBehindMe(this)) { if (iData.actionId == RewiredConsts.Action.HatSwap) { iClothesType = ClothesHolder.HATS_INDEX; } else if (iData.actionId == RewiredConsts.Action.BodySwap) { iClothesType = ClothesHolder.TOPS_INDEX; } else { iClothesType = ClothesHolder.BOTTOMS_INDEX; } data.iSuspicion = 1; } if (iClothesType > -1) { YEO_CLOTHES_SWAP_EVENT lNPCData; YEO_CLOTHES_SWAP_EVENT lOurData; ClothesController clothesNPC = interactable.gameObject.GetComponent <ClothesController>(); if (clothesNPC != null) { lNPCData = clothesNPC.GetClothes(iClothesType); lOurData = clothesController.GetClothes(iClothesType); clothesNPC.SetClothes(iClothesType, lOurData.iID, lOurData.iColor); //Set NPC Clothing clothesController.SetClothes(iClothesType, lNPCData.iID, lNPCData.iColor); //Set ours } //Suspicion if (data.iSuspicion != 0) { EventManager.Instance.FireEvent(data); } } } } else if (iData.actionId == RewiredConsts.Action.SELECT) { data.iSuspicion++; foreach (NPCController interactable in interactables) { interactable.HandleInteraction(data.iSuspicion); } } if (data.iSuspicion != 0) { EventManager.Instance.FireEvent(data); } }