// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { Player = animator.GetComponent <PlayerConroller>(); Player.Drone.gameObject.SetActive(false); Player.Character.gameObject.SetActive(false); }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { Player = animator.GetComponent <PlayerConroller>(); Player.Drone.gameObject.SetActive(true); Player.Drone.Loaded?.Invoke(); }
private void WinUI(PlayerConroller pc) { winobj.SetActive(true); var winner = FindObjectsOfType <PlayerConroller>().Except(pc.Yield()).FirstOrDefault(); winImage.sprite = winner.Image; }
// Use this for initialization void Start() { player = FindObjectOfType <PlayerConroller> (); rBody = GetComponent <Rigidbody2D> (); isChargingRight = false; isChargingLeft = false; }
// Use this for initialization void Start() { player = FindObjectOfType<PlayerConroller> (); rBody = GetComponent<Rigidbody2D> (); isChargingRight = false; isChargingLeft = false; }
void Start() { instance = this; mainCamera = GetComponentInChildren <Camera>().transform; rigidBody = GetComponent <Rigidbody>(); playerCollider = GetComponent <Collider>(); ToggleCursor(false); }
void Start() { wc = GetComponent <WeaponController>(); playerController = transform.parent.GetComponent <PlayerConroller>(); colMask = colMask & ~(1 << playerController.gameObject.layer); colMask2 = colMask; colMask2 = colMask & ~(1 << LayerMask.GetMask("Ground")); }
public void OnCollisionEnter2D(Collision2D collision) { playerController = collision.gameObject.GetComponent <PlayerConroller>(); playerController.shot(); Destroy(gameObject); }
private void OnCollisionEnter2D(Collision2D collision) { playerController = collision.gameObject.GetComponent <PlayerConroller>(); if (collision.gameObject.tag == "Player") { playerController.Smash(); } }
// Start is called before the first frame update public override void Start() { base.Start(); controller = GetComponent <PlayerConroller>(); renderer = GetComponent <SpriteRenderer>(); animator = GetComponent <Animator>(); FaceRight(); isJumping = false; }
private void OnCollisionEnter2D(Collision2D collision) { playerController = collision.gameObject.GetComponent <PlayerConroller>(); if (collision.gameObject.tag == "Player") { playerController.Fall(); source.PlayOneShot(source.clip); } }
public override void Execute(float v, PlayerConroller target) { timer = defaultTimer; var go = Instantiate(projectile, this.transform.position, this.transform.rotation); var rb = go.GetComponent <Rigidbody2D>(); parentRb.AddForce(-weaponForce * transform.up, ForceMode2D.Impulse); Destroy(go, 5); }
public override bool CanExecute(PlayerConroller target) { if (target.inputBlocked != 0) { return(false); } var dist = Vector3.Distance(this.transform.position, target.rbBody.position); return(dist < 1.3f); }
private void OnCollisionEnter2D(Collision2D collision) { playerController = collision.gameObject.GetComponent <PlayerConroller>(); if (collision.gameObject.tag == "Player") { Instantiate(boom, transform.position, Quaternion.identity); playerController.Kaboom(); Destroy(gameObject); } }
internal void UseWeapon(PlayerConroller other) { foreach (var spot in weaponSpots) { if (spot.HasWeapon()) { spot.weapon.Execute(pc.GetCurrentHorizontalForce(), other); spot.taken = false; break; } } }
private void Start() { var child1 = gameObject.transform.Find("Arm_R").GetChild(3).gameObject; var child2 = gameObject.transform.Find("Arm_L").GetChild(3).gameObject; publicSpots.Add(child1); publicSpots.Add(child2); foreach (var spot in publicSpots) { var ws = new WeaponSlot(); ws.go = spot; weaponSpots.Add(ws); } bodyCollider = GetComponent <CircleCollider2D>(); pc = bodyCollider.transform.parent.GetComponent <PlayerConroller>(); }
void Awake() { cameraScript = GetComponent <CameraMovment>(); controllerScript = GetComponent <PlayerConroller>(); if (photonView.isMine) { //MINE: local player, simply enable the local scripts cameraScript.enabled = true; controllerScript.enabled = true; } else { cameraScript.enabled = false; controllerScript.enabled = false; } gameObject.name = gameObject.name + photonView.viewID; }
//End of Variables // Use this for initialization void Start() { //Initialize Components m_Animator = GetComponent <Animator>(); gm = GameObject.Find("GameManager").GetComponent <GameManager>(); gunTypeText = GameObject.Find("GunType").GetComponent <Text> (); ammoTxt = GameObject.Find("ammoTxt").GetComponent <Text> (); reloadBtn = GameObject.Find("Reload").GetComponent <Button>(); player = gameObject.GetComponent <PlayerConroller> (); noGun.SetActive(true); FlagState(hasFlag, mapflagstate); //Button Listeners reloadBtn.onClick.AddListener(() => { Reload(); }); // <-- you assign a method to the button OnClick event here //Initialize Weapon Class smgCS = new WeaponsClasses.SMG1(); arCS = new WeaponsClasses.AR1(); }
public static void spawnTiles() { PlayerConroller.deleteDeadBodies(); destroyDisplayedTiles(); destroyBackupTiles(); getObj(); for (float i = 0.6f; i < lastTileX + 1; i += 2.4f) { for (float j = 4.2f; j > -0.6f; j -= 1.2f) { displayedTiles.Add(Instantiate(empty, new Vector2(i, j) + offset, Quaternion.identity)); } } for (float i = 1.8f; i < lastTileX + 1; i += 2.4f) { float randomVer = (float)((int)((Random.Range(0, 3))) * 1.2 + 0.6); for (float j = 4.2f; j > -0.6f; j -= 1.2f) { if (randomVer >= (j - 0.2) && randomVer <= (j + 0.2)) { displayedTiles.Add(Instantiate(empty, new Vector2(i, j) + offset, Quaternion.identity)); tilesBackup.Add(empty); } else { GameObject g = getRandomTile(); displayedTiles.Add(Instantiate(g, new Vector2(i, j) + offset, Quaternion.identity)); tilesBackup.Add(g); } } } Debug.Log(tilesBackup.Count); doorOBJ = Instantiate(door, doorPos, Quaternion.identity); wallOBJ = Instantiate(wall, wallPos, Quaternion.identity); }
private IEnumerator StartGrow(PlayerConroller pc) { source.Play(); pc.CanGrow = false; AudioSource.PlayClipAtPoint(aclip, Camera.main.transform.position); while (pc.GetBodyScale() < maxScale) { pc.MultiplyScale(growMultiplier); pc.MultiplyLines(growMultiplier); pc.MultiplyRayLine(growMultiplier); yield return(null); } yield return(new WaitForSeconds(cooldown)); while (pc.GetBodyScale() > 1) { pc.MultiplyScale(1 / growMultiplier); pc.MultiplyLines(1 / growMultiplier); pc.MultiplyRayLine(1 / growMultiplier); yield return(null); } pc.CanGrow = true; }
// Use this for initialization void Start() { player = FindObjectOfType<PlayerConroller> (); }
public override void Execute(float v, PlayerConroller target) { AudioSource.PlayClipAtPoint(audioClip, Camera.main.transform.position); target.LoseInput(1.5f); Destroy(this.gameObject); }
public virtual void Affect(PlayerConroller pc) { }
// Use this for initialization void Start() { player = FindObjectOfType <PlayerConroller> (); }
// Use this for initialization void Start() { player = FindObjectOfType<PlayerConroller> (); follow = true; }
public virtual bool CanExecute(PlayerConroller target) { return(timer <= 0.0f && parentRb != null); }
public virtual void Execute(float v, PlayerConroller target) { }
public override void Affect(PlayerConroller pc) { StartCoroutine(StartGrow(pc)); }
public virtual void Start() { pl = GameObject.Find("Player"); playercon = pl.GetComponent <PlayerConroller> (); }
PlayerConroller() { Instance = this; }
// Use this for initialization void Start() { player = FindObjectOfType <PlayerConroller> (); follow = true; }