void Awake() { myAnimator = this.GetComponent <Animator> (); myAesthetic = this.GetComponent <ArtemAestheticController> (); pmc = transform.root.gameObject.GetComponent <PersonMovementController> (); pwc = transform.root.gameObject.GetComponent <PersonWeaponController> (); }
void Awake() { //twoHandADS = this.GetComponent<BoxCollider2D> (); //normal = this.GetComponent<PolygonCollider2D> (); pwc = this.GetComponent <PersonWeaponController> (); if (this.gameObject.GetComponent <NPCController> () == true) { isNPC = true; npc = this.gameObject.GetComponent <NPCController> (); } else { isNPC = false; } CapsuleCollider2D[] cols = this.gameObject.GetComponents <CapsuleCollider2D> (); foreach (CapsuleCollider2D c in cols) { if (c.direction == CapsuleDirection2D.Vertical) { twoHandADS = c; } else { normal = c; } } }
public override void Initialise() { myType = behaviourType.arrestTarget; myController = this.gameObject.GetComponent <NPCController> (); pwc = target.GetComponent <PersonWeaponController> (); myController.detect.target = target; targetStartLoc = target.transform.position; if (myController.memory.objectThatMadeMeSuspisious == null) { } else { if (myController.memory.objectThatMadeMeSuspisious.tag == "NPC") { NPCController npc = myController.memory.objectThatMadeMeSuspisious.GetComponent <NPCController> (); if (myController.npcB.freindlyIDs.Contains(npc.npcB.myID) == true || myController.npcB.myID != npc.npcB.myID) { myController.npcB.suspisious = false; ////////Debug.LogError ("NPC " + this.gameObject.name + " wanted to set alert on freindly npc " + myController.memory.objectThatMadeMeSuspisious); myController.memory.objectThatMadeMeSuspisious = null; Destroy(this); } } } radioMessageOnStart(); isInitialised = true; }
public override bool canDo() { if (npcToDrop == null) { npcToDrop = this.gameObject.GetComponent <NPCController> (); } if (playerWeapon == null) { playerWeapon = CommonObjectsStore.player.GetComponent <PersonWeaponController> (); } if (npcToDrop.pwc.currentWeapon == null) { return(false); } else { if (playerWeapon.currentWeapon == null) { return(false); } else if (playerWeapon.currentWeapon.melee == true) { return(false); } else { return(true); } } return(false); }
void Awake() { pmc = this.gameObject.GetComponentInParent <PersonMovementController> (); pwc = this.gameObject.GetComponentInParent <PersonWeaponController> (); myHealth = this.gameObject.GetComponentInParent <PersonHealth> (); myAesthetic = this.GetComponent <PersonAestheticStore> (); setBodySprites(); myRenderers = this.transform.root.gameObject.GetComponentsInChildren <SpriteRenderer> (); }
void nearbyWeaponPickup() { if (pwc == null) { pwc = CommonObjectsStore.player.GetComponent <PersonWeaponController> (); } List <Weapon> nearbyWeapons = new List <Weapon> (); if (CommonObjectsStore.player.GetComponent <PersonWeaponController> ().currentWeapon == null) { foreach (Item i in nearbyItems) { if (i.GetComponent <Weapon> () == true) { nearbyWeapons.Add(i.GetComponent <Weapon> ()); } } Weapon nearest = null; float dist = 999999.0f; foreach (Weapon w in nearbyWeapons) { if (w.gameObject.activeInHierarchy == true && w.transform.parent == null && w.myContainer == null) { float d = Vector3.Distance(w.gameObject.transform.position, CommonObjectsStore.player.transform.position); if (d < dist) { nearest = w; dist = d; } } } if (nearest == null) { NearbyWeaponPickup.me.disable(); } else { NearbyWeaponPickup.me.setWeapon(nearest); if (Input.GetKeyDown(KeyCode.Z)) { if (Inventory.playerInventory.canWeCarryItem(nearest) == true) { Inventory.playerInventory.addItemToInventory(nearest); nearest.equipItem(); } } } } else { NearbyWeaponPickup.me.disable(); } }
void Update() { if (CommonObjectsStore.player == null) { player = GameObject.FindGameObjectWithTag("Player"); pwc = player.GetComponent <PersonWeaponController> (); pm = player.GetComponent <PersonMovementController> (); pcc = player.GetComponent <PersonClothesController> (); } }
// Use this for initialization void Start() { myAnimator = this.GetComponent <Animator> (); myAesthetic = this.GetComponent <ArtemAestheticController> (); pmc = transform.root.gameObject.GetComponent <PersonMovementController> (); pwc = transform.root.gameObject.GetComponent <PersonWeaponController> (); rightHand = myAesthetic.rHandObj; leftHand = myAesthetic.lHandObj; setMovingForward(); }
void Awake() { pmc = this.GetComponent <PersonMovementController> (); pwc = this.GetComponent <PersonWeaponController> (); inv = this.GetComponent <Inventory> (); detect = this.GetComponent <CanWeDetectTarget> (); pf = this.GetComponent <PathFollower> (); memory = this.GetComponent <NPCMemory> (); npcB = this.GetComponent <NPCBehaviourDecider> (); myCol = this.GetComponent <PersonColliderDecider> (); myHealth = this.gameObject.GetComponent <PersonHealth> (); ac = this.GetComponentInChildren <ArtemAnimationController> (); pcc = this.GetComponent <PersonClothesController> (); }
void Awake() { rid = this.GetComponent <Rigidbody2D> (); hc = this.GetComponentInChildren <HeadController> (); //this.gameObject.GetComponentInChildren<AnimationController> ().head.GetComponent<HeadController> (); pwc = this.gameObject.GetComponent <PersonWeaponController> (); if (this.gameObject.GetComponent <PathFollower> () == null) { } else { pl = this.gameObject.GetComponent <PathFollower> (); } //myLegs = this.gameObject.GetComponentInChildren<Legs> (); }
void Awake() { me = this; mainCam = Camera.main; player = GameObject.FindGameObjectWithTag("Player"); pwc = player.GetComponent <PersonWeaponController> (); pm = player.GetComponent <PersonMovementController> (); pcc = player.GetComponent <PersonClothesController> (); if (LoadingDataStore.me == null) { GameObject g = new GameObject(); g.name = "Load Data Store"; g.AddComponent <LoadingDataStore> (); } }
public void dealMeleeDamage(int damage, bool chanceOfBleed) { if (pwc == null) { pwc = this.gameObject.GetComponent <PersonWeaponController> (); } if (damage <= 100) { this.gameObject.GetComponent <AudioController> ().playSound(SFXDatabase.me.bluntImpact); } else { if (chanceOfBleed == false) { this.gameObject.GetComponent <AudioController> ().playSound(SFXDatabase.me.bluntImpact); } else { this.gameObject.GetComponent <AudioController> ().playSound(SFXDatabase.me.bladedImpact); } } float modifier = 1.0f; if (EffectsManager.me != null) { foreach (EffectBase eb in EffectsManager.me.effectsOnPlayer) { modifier += eb.damageMod; } } float dam = damage * modifier; if (pwc.blocking == true) { dealDamage(Mathf.RoundToInt(dam) / 5, false); } else { dealDamage(Mathf.RoundToInt(dam), true); } }
void Awake() { me = this; pmc = this.gameObject.GetComponent <PersonMovementController> (); pwc = this.gameObject.GetComponent <PersonWeaponController> (); }
public override void doAction() { illigal = true; //this.transform.parent = CommonObjectsStore.player.transform; //this.gameObject.transform.rotation = Quaternion.Euler (0, 0, 0); if (hostage == null) { hostage = this.GetComponent <NPCController> (); } if (hostage.currentBehaviour == null) { } else { Destroy(hostage.currentBehaviour); } if (hostage.myHealth.healthValue <= 0) { onComplete(); } else { doing = true; if (hostage.npcB.myType != AIType.hostage) { hostage.npcB.myType = AIType.hostage; this.gameObject.tag = "NPC"; hostage.detect.fov.viewMeshFilter.gameObject.SetActive(false); Inventory i = this.gameObject.GetComponent <Inventory> (); List <Item> items = i.inventoryItems; foreach (Item it in items) { it.dropItem(); } i.inventoryItems.Clear(); //PersonAnimationController pac = this.gameObject.GetComponent<PersonAnimationController> (); //pac.animationsToPlay.Clear (); //pac.playAnimation ("TiedUp", false); //pac.playing = null; //pac.forceFinishCurrentAnim (); //hostage.head.gameObject.SetActive (false); //hostage.knockedDown = false; // this.gameObject.GetComponent<Collider2D> ().isTrigger = true; PlayerActionUI.me.lastObjectSelected = null; this.gameObject.GetComponent <PersonColliderDecider>().setTrigger(); PersonWeaponController pwc = this.gameObject.GetComponent <PersonWeaponController> (); if (pwc.currentWeapon == null) { } else { pwc.currentWeapon.dropItem(); pwc.currentWeapon = null; } pwc.enabled = false; pmc = this.gameObject.GetComponent <PersonMovementController> (); this.gameObject.transform.position = CommonObjectsStore.player.transform.position + (CommonObjectsStore.player.transform.up / 2); this.gameObject.transform.parent = CommonObjectsStore.player.transform; this.gameObject.transform.rotation = Quaternion.Euler(0, 0, CommonObjectsStore.player.transform.eulerAngles.z); player_pmc = CommonObjectsStore.player.GetComponent <PersonMovementController> (); this.gameObject.GetComponent <SpriteRenderer> ().sortingOrder = 4; } else { wasHostageBefore = true; hostage.npcB.myType = AIType.hostage; this.gameObject.tag = "NPC"; hostage.detect.fov.viewMeshFilter.gameObject.SetActive(false); //Inventory i = this.gameObject.GetComponent<Inventory> (); //List<Item> items = i.inventoryItems; //foreach (Item it in items) { // it.dropItem (); //} //i.inventoryItems.Clear (); ////PersonAnimationController pac = this.gameObject.GetComponent<PersonAnimationController> (); //pac.animationsToPlay.Clear (); //pac.playAnimation ("TiedUp", false); //pac.playing = null; //pac.forceFinishCurrentAnim (); //hostage.head.gameObject.SetActive (false); //hostage.knockedDown = false; //this.gameObject.GetComponent<Collider2D> ().isTrigger = true; this.gameObject.GetComponent <PersonColliderDecider>().setTrigger(); PersonWeaponController pwc = this.gameObject.GetComponent <PersonWeaponController> (); if (pwc.currentWeapon == null) { } else { pwc.currentWeapon.dropItem(); pwc.currentWeapon = null; } pwc.enabled = false; pmc = this.gameObject.GetComponent <PersonMovementController> (); this.gameObject.transform.position = CommonObjectsStore.player.transform.position + (CommonObjectsStore.player.transform.up / 2); this.gameObject.transform.parent = CommonObjectsStore.player.transform; this.gameObject.transform.rotation = Quaternion.Euler(0, 0, CommonObjectsStore.player.transform.eulerAngles.z); player_pmc = CommonObjectsStore.player.GetComponent <PersonMovementController> (); this.gameObject.GetComponent <SpriteRenderer> ().sortingOrder = 4; } this.gameObject.transform.position = CommonObjectsStore.player.transform.position + (CommonObjectsStore.player.transform.up / 2); this.gameObject.GetComponentInChildren <CircleCollider2D> ().enabled = false; pmc.movedThisFrame = player_pmc.movedThisFrame; hostage.ac.setHumanShield(); //pmc.legAnimate (); if (hostage.detect.fov.viewMeshFilter.gameObject.activeInHierarchy == true) { hostage.detect.fov.viewMeshFilter.gameObject.SetActive(false); } if (PlayerAction.currentAction != this && transform.parent != null) { PlayerAction.currentAction = this; } } //if (Input.GetKeyDown (KeyCode.E)) { // onComplete (); //} //if (setRot == false) { //this.transform.position = Vector3.zero; //this.gameObject.transform.position = CommonObjectsStore.player.transform.position - Vector3.up; // setRot = true; //} }
void Awake() { pwc = this.GetComponentInParent <PersonWeaponController> (); }