public static bool CompareWeapon(WeaponControl wp1, WeaponControl wp2) { bool retVal = false; if (wp1.weaponType == wp2.weaponType) { int random = Random.Range(0, 11); if (random <= 5) retVal = true; } else { if (wp1.weaponType == WeaponManager.WeaponType.Rifle) { retVal = true; } if (wp1.weaponType == WeaponManager.WeaponType.Pistol) { if (wp2.weaponType == WeaponManager.WeaponType.Pistol) { retVal = true; } } } return retVal; }
void Awake() { rigidbody2D = GetComponent <Rigidbody2D> (); anim = GetComponent <Animator> (); rateOfFire = maxRateOfFire; curHealth = maxHealth; weaponControl = GetComponent <WeaponControl> (); }
public void WiggleCrosshairAndCamera(WeaponControl weapon, bool shoot) { //activeCrosshair.WiggleCrosshair(); if (shoot) { offsetY = weapon.Kickback; } }
void CreatePlayer(Vector3 birthPos) { // weapon part 1 GameObject weaponObj = assault74M; string weaponName = gi.getWeapon(); if (string.Equals(weaponName, "Assault-91")) { weaponObj = assault91; } else if (string.Equals(weaponName, "Assault971")) { weaponObj = assault971; } else if (string.Equals(weaponName, "Assault2002")) { weaponObj = assault2002; } else if (string.Equals(weaponName, "AssaultMAS")) { weaponObj = assaultMAS; } // costume part string costumeName = gi.getCostume(); // create character string[] param = new string[2]; param[0] = costumeName; param[1] = weaponName; player = PhotonNetwork.Instantiate("Player", birthPos, Quaternion.identity, 0, param); standFirePos = player.transform.FindChild("StandFirePos"); crouchFirePos = player.transform.FindChild("CrouchFirePos"); standFocus = player.transform.FindChild("StandFocus"); crouchFocus = player.transform.FindChild("CrouchFocus"); swapCameraPos = player.transform.FindChild("Bip001 R Hand").FindChild("SwapCameraPos"); cameraPos = new GameObject("CameraPos"); cameraPos.transform.position = standFirePos.position; firePos = standFirePos; focus = standFocus; pc = player.GetComponent <PlayerControl>(); uc = player.GetComponent <UIControl>(); // weapon part 2 weapon = (GameObject)Instantiate(weaponObj, Vector3.zero, Quaternion.identity); wc = weapon.GetComponent <WeaponControl>(); weapon.transform.SetParent(weaponPos.FindChild(weaponName)); weapon.transform.position = weaponPos.FindChild(weaponName).position; weapon.transform.localPosition = new Vector3(0, 0, 0); weapon.transform.localRotation = Quaternion.identity; uc.setWeapon(weaponObj.name); pc.setWeapon(weaponObj.name); gameStarted = true; setCanvas(1); }
/// <summary> /// Awake this instance. /// </summary> void Awake() { weapon = GetComponentInChildren <WeaponControl> (); playerRigidbody = GetComponent <Rigidbody> (); meshPlayer = GetComponent <MeshRenderer> (); playerMat = meshPlayer.material; dashVFX = dashParticle.GetComponentInChildren <ParticleSystem>(); main = dashVFX.main; }
private void Start() { weaponControl = GetComponent <WeaponControl>(); List <BaseStat> swordStats = new List <BaseStat>(); swordStats.Add(new BaseStat(4, "Power", "Your power level.")); sword = new Item(swordStats, "Sword"); weaponControl.EquipWeapon(sword); }
void Start() { deathParticles = GetComponent <ParticleSystem>(); playerMov = GetComponent <MovementScript>(); playerWeapon = GetComponent <WeaponControl>(); playerSprite = GetComponent <SpriteRenderer>(); playerTransform = GetComponent <Transform>(); animator = GetComponent <Animator>(); knightAbility = GetComponent <KnightAbilityControll>(); }
void Start() { playerTag = "Player" + Utility.GetPlayerIndexFromBullet(this.gameObject.tag); player = GameObject.FindGameObjectWithTag(playerTag); weapon = player.GetComponentInChildren <WeaponControl> (); Quaternion yValue = Quaternion.Euler(0, 0, Random.Range(-spreadValue, spreadValue)); bulletRb.transform.rotation = bulletRb.transform.rotation * yValue; }
// Use this for initialization void Awake() { player = GameObject.Find("Player"); player_arm = player.GetComponent <ArrowKeyMovement>(); player_tf = player.GetComponent <Transform>(); player_wc = player.GetComponent <WeaponControl>(); sr = GetComponent <SpriteRenderer>(); rb = GetComponent <Rigidbody>(); start_time = Time.time; }
public static void ChangeWeapon(GameObject target, SkillWeaponInfo param) { WeaponControl control = target.GetComponent <WeaponControl>(); if (control == null) { LogicSystem.GfxLog("ShooterSkillExecutor WeaponControl Script miss!"); } control.ChangeWeapon(param); }
// Start is called before the first frame update void Start() { playerMove = GetComponent <PlayerMove>(); weaponControl = GetComponent <WeaponControl>(); audioSource = GetComponent <AudioSource>(); goal.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); playerGoal = false; playerGameOver = false; weaponPoint = 5; hp = 100; }
public static GameObject GetWeaponByHand(GameObject target, WeaponHand hand) { WeaponControl control = target.GetComponent <WeaponControl>(); if (control == null) { LogicSystem.GfxLog("ShooterSkillExecutor WeaponControl Script miss!"); return(null); } return(control.GetWeaponByHand(hand)); }
public static int GetCurWeaponId(GameObject target, MasterWeaponType masterType = MasterWeaponType.Master) { WeaponControl control = target.GetComponent <WeaponControl>(); if (control == null) { LogicSystem.GfxLog("ShooterSkillExecutor GetCurWeaponId Script miss!"); return(-1); } return(control.GetCurWeaponId(masterType)); }
public static bool CheckAmmo(WeaponControl AW) { if (AW.curAmmo > 0) { return true; } else { return false; } }
public void InitUnitWeapon() { foreach (MonoBehaviour behavior in this.GetComponents <MonoBehaviour>()) { if (behavior is WeaponControl) { this.currentWeapon = behavior as WeaponControl; break; } } }
public static void SwitchNextWeapon(GameObject target) { WeaponControl control = target.GetComponent <WeaponControl>(); if (control == null) { LogicSystem.GfxLog("SwitchWeapon WeaponControl Script miss!"); return; } control.SwitchNextWeapon(); }
public static bool CheckAmmo(WeaponControl AW) { if (AW.curAmmo > 0) { return(true); } else { return(false); } }
// Use this for initialization void Start () { ActiveWeapon = WeaponList [weaponNumber].GetComponent<WeaponControl> (); ActiveWeapon.equip = true; anim=GetComponent<Animator> (); foreach (GameObject go in WeaponList) { go.GetComponent<WeaponControl>().hasOwner = true; } }
// Use this for initialization void Start() { //Debug.Log(weaponNumber.ToString()); ActiveWeapon = WeaponList[weaponNumber].GetComponent <WeaponControl>(); ActiveWeapon.equip = true; anim = GetComponentInChildren <Animator>(); foreach (GameObject go in WeaponList) { go.GetComponent <WeaponControl>().hasOwner = true; //go.GetComponent<Collider>().isTrigger = true; } }
// Use this for initialization void Start() { myManager = FindObjectOfType <GameManagerScript>(); myWeaponControl = GetComponentInChildren <WeaponControl>(); // HindSight is 20/20, should have renamed the bones in 3ds Max rightShoulder = GameObject.Find("Bone001"); //rightArm = GetComponent<Transform>().Find("Bone003"); leftShoulder = GameObject.Find("Bone004"); //leftArm = GetComponent<Transform>().Find("Bone006"); centralColumn = GameObject.Find("Bone007"); }
private void UpdateAttacks() { stackAttacks.Children.Clear(); List <Weapon> weps = inventory.GetAllWeapons(); WeaponControl wep; foreach (Weapon w in weps) { wep = new WeaponControl(w, this, c); stackAttacks.Children.Add(wep); } }
// Use this for initialization void Awake() { direction = "down"; rb = GetComponent <Rigidbody>(); wc = GetComponent <WeaponControl>(); camera_moving = false; knocking = false; dead = false; catching = false; flying = false; enter_oldMan = false; gold = false; knocking_speed = new Vector2(0, 0); }
void die_player() { player.gameObject.GetComponent <FirstPersonController>().GetEntity().GetState <IPlayerState>().deaths++; WeaponControl weapons = EquipmentUI.GetComponent <WeaponControl>(); weapons.openMenu(); var evnt = PlayerVisibilityChanged.Create(Bolt.GlobalTargets.Others); evnt.Player = player.GetComponent <FirstPersonController>().GetEntity(); evnt.Visible = false; evnt.Send(); player.SetActive(false); }
float IKweight; //our ik weight void Start() { //the active weapon is taken from our weapon list's index ActiveWeapon = WeaponList[weaponNumber].GetComponent <WeaponControl>(); ActiveWeapon.equip = true; //and we equip that weapon anim = GetComponent <Animator>(); //setup the refence to the animator //and for every weapon that we have on our list, we inform it that they have an owner //so they are placed in the correct position foreach (GameObject go in WeaponList) { go.GetComponent <WeaponControl>().hasOwner = true; } }
void Start() { rigid = GetComponent <Rigidbody2D>(); char2D = GetComponent <Character2D>(); theGun = GameObject.Find("gun"); weaponControl = theGun.GetComponent <WeaponControl>(); crouchSpeed = 0.3f; normalSpeed = 0.5f; jumpSpeed = 0.3f; slow = false; }
float IKweight; //our ik weight void Start () { //the active weapon is taken from our weapon list's index ActiveWeapon = WeaponList[weaponNumber].GetComponent<WeaponControl>(); ActiveWeapon.equip = true; //and we equip that weapon anim = GetComponent<Animator>(); //setup the refence to the animator //and for every weapon that we have on our list, we inform it that they have an owner //so they are placed in the correct position foreach(GameObject go in WeaponList) { go.GetComponent<WeaponControl>().hasOwner = true; } }
public void ChooseWeapon(WeaponControl w) { chosenWeaponControl = w; foreach (WeaponControl wepCon in stackAttacks.Children) { if (wepCon == w) { wepCon.Highlight(true); } else { wepCon.Highlight(false); } } }
void Start() { deathParticles = GetComponent <ParticleSystem>(); playerMov = GetComponent <MovementScript>(); playerWeapon = GetComponent <WeaponControl>(); playerSprite = GetComponent <SpriteRenderer>(); playerTransform = GetComponent <Transform>(); if (playerClass == PlayerClass.Knight) { knightController = GetComponent <KnightStateController>(); } if (playerClass == PlayerClass.BasicGuy) { basicGuyController = GetComponent <BasicGuyStateController>(); } }
// Update is called once per frame void Update () { IKweight = Mathf.MoveTowards (IKweight, (aim) ? 1.0f : 0.0f, Time.deltaTime * 5); ActiveWeapon = WeaponList [weaponNumber].GetComponent<WeaponControl> (); ActiveWeapon.equip = true; weaponType = ActiveWeapon.weaponType; switch (weaponType) { case WeaponType.Pistol: anim.SetInteger("Weapon",0); break; case WeaponType.Rifle: anim.SetInteger("Weapon",1); break; } }
void Start() { gun = GameObject.Find("gun"); weaponControl = gun.GetComponent <WeaponControl>(); cylinder = GameObject.Find("UI-Cylinder"); bulletCasings = GameObject.FindGameObjectsWithTag("UI-Bullet"); uiAmmo = GameObject.Find("TotalAmmo"); ammoText = uiAmmo.GetComponent <Text>(); // uiHeart = GameObject.Find("Heart"); heartImg = uiHeart.GetComponent <Image>(); // uiHP = GameObject.Find("HP"); hpText = uiHP.GetComponent <Text>(); // uiBottle = GameObject.Find("BottleText"); bottleText = uiBottle.GetComponent <Text>(); // magCounter = 6; inMag = weaponControl.inMag; ammo = weaponControl.ammo; maxAmmo = weaponControl.maxAmmo; fireRate = weaponControl.fireRate; guy = GameObject.Find("Guy"); character2d = guy.GetComponent <Character2D>(); hp = character2d.health; maxHP = character2d.maxHealth; bottles = character2d.bottles; maxBottles = character2d.maxBottles; spinning = false; reloading = false; //spinTime = new Vector3(0, 0, 1.2245f); // Find better way to get accurate rotation spinTime = new Vector3(0, 0, 1.0f); ammoText.text = "" + ammo; bottleText.text = "" + bottles; hpText.text = "" + hp; heartImg.fillAmount = hp; userControl = guy.GetComponent <UserControl>(); bulletTime = GameObject.Find("UITimer"); bulletTimeFill = bulletTime.GetComponent <Image>(); }
public void spawnPlayer() { var evnt = PlayerVisibilityChanged.Create(Bolt.GlobalTargets.Others); evnt.Player = player.GetComponent <FirstPersonController>().GetEntity(); evnt.Visible = true; evnt.Send(); player.SetActive(true); player.GetComponent <FirstPersonController>().bindMouse(); activate_ALIVE_UI(); ArmorAndWeapons armor = ArmorUI.GetComponent <ArmorAndWeapons>(); Stamina stamina = StaminaUI.GetComponent <Stamina>(); Hearts health = HealthUI.GetComponent <Hearts>(); WeaponControl weapons = EquipmentUI.GetComponent <WeaponControl>(); armor.resetArmor(); stamina.resetStamina(); health.resetHealth(); weapons.onSpawn(); player.transform.position = randomSpawnpoint(); }
// Use this for initialization void Start() { aiMovementMode = moveMode.Command; agent.updatePosition = false; agent.updateRotation = false; vehicleType = controller.vehicle.type; switch (vehicleType) { case Vehicle.vehicleType.Tank: attackController = GetComponentInChildren <TankTurretControl>(); break; case Vehicle.vehicleType.Truck: break; case Vehicle.vehicleType.Heli: break; case Vehicle.vehicleType.Spy: break; case Vehicle.vehicleType.Base: break; default: attackController = GetComponentInChildren <WeaponControl>(); break; } Vehicle v = GetComponent <VehicleController>().vehicle; attackRange = v.attackRange; sightRange = v.sightRange; oldPos = transform.position; }
void Update() { //The ikweight is based on if we are aiming or not IKweight = Mathf.MoveTowards(IKweight, (aim)? 1.0f : 0.0f, Time.deltaTime * 5); //Again the active weapon is based on the index of the weapon list ActiveWeapon = WeaponList[weaponNumber].GetComponent <WeaponControl>(); ActiveWeapon.equip = true; //and our weapon type is the same as the active weapon weaponType = ActiveWeapon.weaponType; //we setup the correct animations for each weapon, based on weapon type switch (weaponType) { case WeaponType.Pistol: anim.SetInteger("Weapon", 0); break; case WeaponType.Rifle: anim.SetInteger("Weapon", 1); break; } }
void Update () { //The ikweight is based on if we are aiming or not IKweight = Mathf.MoveTowards(IKweight,(aim)? 1.0f : 0.0f, Time.deltaTime * 5); //Again the active weapon is based on the index of the weapon list ActiveWeapon = WeaponList[weaponNumber].GetComponent<WeaponControl>(); ActiveWeapon.equip = true; //and our weapon type is the same as the active weapon weaponType = ActiveWeapon.weaponType; //we setup the correct animations for each weapon, based on weapon type switch(weaponType) { case WeaponType.Pistol: anim.SetInteger("Weapon",0); break; case WeaponType.Rifle: anim.SetInteger("Weapon",1); break; } }
public void InitUnitWeapon() { foreach(MonoBehaviour behavior in this.GetComponents<MonoBehaviour>()) { if(behavior is WeaponControl) { this.currentWeapon = behavior as WeaponControl; break; } } }
// Use this for initialization void Start() { //Debug.Log(weaponNumber.ToString()); ActiveWeapon = WeaponList[weaponNumber].GetComponent<WeaponControl>(); ActiveWeapon.equip = true; anim = GetComponentInChildren<Animator>(); foreach (GameObject go in WeaponList) { go.GetComponent<WeaponControl>().hasOwner = true; //go.GetComponent<Collider>().isTrigger = true; } }
public void DelegateFireAndReload() { // Clear delegates primaryFire = null; secondaryFire = null; secondaryReload = null; primaryFireSound = null; secondaryFireSound = null; // Loop through children foreach(Transform child in transform) { // Get child's WeaponControl script tempScript = child.GetComponent<WeaponControl>(); // Check if child has a WeaponControl script if(tempScript!=null) { // Check if child is a Primary Weapon if(tempScript.weaponType==1) { // Store FireCall() in a delegate primaryFire += tempScript.FireCall; int ii = 0; bool matched = false; while(ii<child.GetSiblingIndex()) { if(transform.GetChild(ii).name == child.name) { matched = true; } ii++; } if(!matched) { primaryFireSound += tempScript.FiringSoundCall; } } // Check if child is a Secondary Weapon else if(tempScript.weaponType==2) { // Store FireCall() in a delegate secondaryFire += tempScript.FireCall; int ii = 0; bool matched = false; while(ii<child.GetSiblingIndex()) { if(transform.GetChild(ii).name == child.name) { matched = true; } ii++; } if(!matched) { secondaryFireSound += tempScript.FiringSoundCall; } // Store ReloadCall() in a delegate secondaryReload += tempScript.ReloadCall; } } } }
void Awake () { CharHealth = this.CharacterHealth; WeapControl = this.WeaponControl; }
protected override void Awake() { base.Awake(); skills = new MobSkills(); _anim = GetComponent<Animator>(); _weaponcontrol = GetComponent<WeaponControl>(); }
private void Start() { _playerAgent = GetComponent <NavMeshAgent>(); _weaponController = GetComponent <WeaponControl>(); _charStats = GetComponent <CharacterStats>(); }
public void setWeapon(string weaponName) { wc = GameObject.Find(weaponName + "(Clone)").GetComponent <WeaponControl>(); }