public override void Construct() { //TODO måste lista ut hur vi ska göra för att hämta saker som hitboxes på ett smidigt sätt //alla hitboxes har en ID som man letar efter hitBox = context.owner.GetComponentInChildren <HitBoxController>(); _constructed = true; }
void Start() { playerInput = GameObject.Find("PlayerInput"); animator = GetComponentInParent <Animator>(); //Find player's input buffer InputBuffer[] buff = FindObjectsOfType(typeof(InputBuffer)) as InputBuffer[]; for (int i = 0; i < buff.Length; i++) { if (buff[i].playerNumber == playerNumber) { inputBuffer = buff[i]; } } //Find opponent GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); for (int i = 0; i < players.Length; i++) { if (players[i].GetComponent <PlayerController>()) { if (players[i].GetComponent <PlayerController>().playerNumber != playerNumber) { opponent = players[i]; } } } hitBoxController = GetComponent <HitBoxController>(); }
private void SetSingleton() { if (_instance != null && _instance != this) { Destroy(this.gameObject); } else { _instance = this; } }
private void Start() { navigation = GetComponent <NavMeshAgent>(); stateMachine.ChangeState(idleState); whipHitBoxController = whipHitBox.GetComponent <HitBoxController>(); if (player == null) { player = GameObject.FindGameObjectWithTag("Player").transform; } }
void Start() { _HitBoxController = GameObject.Find("BoxToHit").GetComponent <HitBoxController>(); greatAnimator = GameObject.Find("GreatImage").GetComponent <Animator>(); failAnimator = GameObject.Find("FailImage").GetComponent <Animator>(); score = 0; timeNotOver = true; notFailedYet = true; spawnTime = Time.time; Cubetransform = GameObject.Find("Cube"); BoxToHit = GameObject.Find("BoxToHit").transform; scoreText = GameObject.Find("ScoreText").GetComponent <TextMeshProUGUI>(); }
//public Animator animator; private void Awake() { stateMachine = new StateMachine <AlexPlayerController>(this); playerIdleState = new PlayerIdleState(); playerRunningState = new PlayerRunningState(); playerJumpingState = new PlayerJumpingState(); playerFallingState = new PlayerFallingState(); playerAttackingState = new PlayerAttackingState(); stateMachine.ChangeState(playerIdleState); rb = GetComponent <Rigidbody>(); attackHitboxScript = attackHitboxObject.GetComponent <HitBoxController>(); }
private void CreateBullet() { float angle = Mathf.Atan2(Target.y - transform.position.y, Target.x - transform.position.x); if (_BulletPrefab != null) { GameObject bullet = Instantiate(_BulletPrefab, transform.position, Quaternion.Euler(0, 0, angle * 180 / Mathf.PI)); bullet.tag = tag; HitBoxController bulletHitBox = bullet.GetComponent <HitBoxController>(); bulletHitBox.HitTags = _HitTags; } else { Debug.LogError("No Bullet Prefab"); } }
public void Start() { rb = GetComponent <Rigidbody>(); anim = GetComponent <Animator>(); isdead = false; health = maxhealth; shotsfiredbool = false; isalert = false; dummyweapontimer = 6; dummyweapon.SetActive(false); dummyweaponadded = false; firing = false; NewActionTimer = NewActionTimerStart; strobelight.SetActive(false); rb.maxAngularVelocity = .5f; Hoxie = HitBoxManager.GetComponent <HitBoxController>(); aggro = false; locale = 0; walkstutter = 2; civvytimer = 30; }