void Awake() { charactervars = mainchar.GetComponent <mainCharacterVars>(); interact1 = npc1.GetComponent <interact>(); give1 = npc1.GetComponent <npcGiveTask>(); interact2 = npc2.GetComponent <interact>(); give2 = npc2.GetComponent <npcGiveTask>(); interact3 = npc3.GetComponent <interact>(); give3 = npc3.GetComponent <npcGiveTask>(); interact4 = npc4.GetComponent <interact>(); give4 = npc4.GetComponent <npcGiveTask>(); interactWithMarket = market.GetComponent <interactWith>(); interactWithMailman = mailman.GetComponent <interactWith>(); interactWithBank = bank.GetComponent <interactWith>(); interactWithPizza = pizza.GetComponent <interactWith>(); day2timelimitnoti.text = ""; day2notitimer = 8.5f; tutorialtext.text = ""; if (selectedtutorial) { tutorialpos = 0; tutorialbox.SetActive(true); } else { tutorialpos = 25; tutorialbox.SetActive(false); } }
void shoot() { if (shootingAudio != null) { audioSource.PlayOneShot(shootingAudio); } if (_scope == null || _scope.IsScoped == 0) { animator.SetTrigger("shoot"); } transform.parent.transform.parent.GetComponent <MouseLook>().AddRecoil(upRecoil, Random.Range(-sideRecoil, sideRecoil)); bullets -= 1; muzzleFlash.Play(); RaycastHit hit; if (Physics.Raycast(cam.position, cam.forward, out hit, range, interactable)) { interact target = hit.transform.GetComponent <interact>(); target.Damage(damage); target.Hit(hit.point, Quaternion.LookRotation(hit.normal)); Rigidbody rb = hit.transform.GetComponent <Rigidbody>(); if (rb != null) { rb.AddForce(force * hit.normal * -1, ForceMode.Impulse); } } }
private void DeleteRoomEvents() { Takeable = null; Pushable = null; Pullable = null; RoomUse_Event = null; }
// draw velocity vector //void OnDrawGizmos() //{ // // draw trajectory // if (agent == null || agent.path == null) // return; // var line = this.GetComponent<LineRenderer>(); // if (line == null) // { // line = this.gameObject.AddComponent<LineRenderer>(); // line.material = new Material(Shader.Find("Sprites/Default")) { color = Color.yellow }; // line.startWidth = 0.1f; // line.endWidth = 0.2f; // line.startColor = Color.yellow; // line.endColor = Color.red; // } // var path = agent.path; // line.SetPositions(path.corners); //} void Start() { // Set values agent = GetComponent <NavMeshAgent>(); anim = GetComponentInChildren <Animator>(); interactScript = this.GetComponent <interact>(); lookAtScript = this.GetComponent <lookAt>(); // enable lookAt enableLookAt(0); // Don’t update position automatically agent.updatePosition = false; // start path to first target resetDestination(); // if on a conversation do not move or interact if (interactScript.onConversation) { interactScript.Start(); interactScript.startToConversate(); return; } // if its animated start triggering animations if (interactScript.animated) { interactScript.callTriggerInteraction(); } }
void Start() { mainvars = mainCharacter.GetComponent <mainCharacterVars>(); dictInitialize = mainScriptMan.GetComponent <dictInitialize>(); interact = GetComponent <interact>(); interactWith = GetComponent <interactWith>(); oneperday = dayNight.dayCount; }
// Start is called before the first frame update void Start() { rb2 = GetComponent <Rigidbody2D>(); rb2.gravityScale = 0.0f; interactStatus = GameObject.Find("interactSwitch"); script = interactStatus.GetComponent <interact>(); mode = 0; }
private void OnTriggerEnter(Collider other) { if (isAttacking) { interact health = other.GetComponent <interact>(); if (health != null) { health.Damage(damage); } } }
void Awake() { dictRef = mainScriptMan.GetComponent <dictInitialize>(); mainCharacterVars = mainCharacter.GetComponent <mainCharacterVars>(); interact = GetComponent <interact>(); npcConversation = GetComponent <npcConversation>(); interactWithMarket = market.GetComponent <interactWith>(); interactWithMailman = mailman.GetComponent <interactWith>(); interactWithBank = bank.GetComponent <interactWith>(); interactWithPizza = pizza.GetComponent <interactWith>(); interactWithMayor = mayor.GetComponent <interactWith>(); interactWithShady = shadyCharacter.GetComponent <interactWith>(); friendship = GetComponent <npcfriendship>(); easyTaskPrompts[0].construct(new List <string> { "bring", " ", "this", " ", "mail", " ", "to", " ", "the", " ", "post office" }, "post office", "mail"); easyTaskPrompts[1].construct(new List <string> { "bring", " ", "this", " ", "money", " ", "to", " ", "the", " ", "bank" }, "bank", "money"); easyTaskPrompts[2].construct(new List <string> { "bring", " ", "this", " ", "document", " ", "to", " ", "the", " ", "town hall" }, "town hall", "document"); easyTaskPrompts[3].construct(new List <string> { "bring", " ", "these", " ", "good", "s", " ", "to", " ", "the", " ", "alley" }, "alley", "good"); //mediTaskPrompts[0].construct(new List<string> { "tell", " ", "me", " ", "where", " ", "you", " ", "are", " ", "from" }, "currentNPC", "whereFrom"); hardTaskPrompts[0].construct(new List <string> { "I", " ", "need", " ", "meat", " ", "from", " ", "the", " ", "market" }, "market", "meat"); hardTaskPrompts[1].construct(new List <string> { "I", " ", "need", " ", "bread", " ", "from", " ", "the", " ", "market" }, "market", "bread"); hardTaskPrompts[2].construct(new List <string> { "I", " ", "need", " ", "grape", "s", " ", "from", " ", "the", " ", "market" }, "market", "grape"); hardTaskPrompts[3].construct(new List <string> { "get", " ", "me", " ", "a", " ", "pizza", " ", "with", " ", "meat" }, "pizza", "meat"); hardTaskPrompts[4].construct(new List <string> { "get", " ", "me", " ", "a", " ", "pizza", " ", "with", " ", "tomato" }, "pizza", "tomato"); hardTaskPrompts[5].construct(new List <string> { "get", " ", "me", " ", "a", " ", "pizza", " ", "with", " ", "olive", "s" }, "pizza", "olive"); //hardTaskPrompts[0].construct(new List<string> { "tell", " ", "him", " ", "to", " ", "come", " ", "over", " ", "here" }, "otherNPC", "come"); taskavailable.SetActive(false); taskwiththisNPC = false; taskinprog.SetActive(false); completed = false; almostdonestar.SetActive(false); }
private string Do(Actor a, interact thing, string action) { if (thing != null) { if (!(bool)thing?.Invoke(a)) { return($"{action}ing the {Name} failed."); } return($"You {action} the {Name}."); } return($"You can't {action} that."); }
void Awake() { Instance = this; // Make singleton Instance //Messenger<string>.AddListener(GameEvent.TALK_TO, startTalking); }
private void DeleteAllEvents() { DeleteRoomEvents(); PlayerUse_Event = null; }