void Start() { minSwipeDist = 1; controlledPlayer = GetComponent<PlayerWalk>(); cam = Camera.main; old_cam_pos = cam.transform.position; }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); } PauseGameManager.Instance.register(this, gameObject); jump = GetComponent <Jump>(); walk = GetComponent <PlayerWalk>(); firePivot = transform.FindChild("FirePivot"); teleportable = GetComponent <Teleportable>(); dieAnim = GetComponent <PlayerDieAnim>(); crouch = GetComponent <Crouch>(); idle = GetComponent <Idle>(); lookUpwards = GetComponent <LookUpwards>(); body = GetComponent <ChipmunkBody>(); walkVelBackup = walkVelocity; rightFireDir.x = 1f; rightFireDir.y = -0.5f; leftFireDir.x = -1f; leftFireDir.y = -0.5f; fireDir = rightFireDir; collisionGroupSkip = GetComponent <ChipmunkShape>().collisionGroup; collisionLayers = unchecked ((uint)~(1 << gameObject.layer)); // all layers except Player's layer }
private void Awake() { rigRigidbody = GetComponent <Rigidbody>(); playerInput = GetComponent <PlayerInput>(); playerClimb = GetComponent <PlayerClimb>(); playerWalk = GetComponent <PlayerWalk>(); }
private void Awake() { weapon = GetComponent <WeaponController>(); energy = GetComponent <EnergyController>(); playerWalk = GetComponent <PlayerWalk>(); sounds = GetComponent <Sounds>(); }
void Awake() { currentHealth = startingHealth; playerMovement = GetComponent <PlayerWalk> (); playerShooting = GetComponentInChildren <PlayerShooting>(); gm = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>(); }
private void Start() { base.Initial(); Animator animator; animator = GetComponent <Animator>(); #region 设置角色控制器的大小 control = GetComponent <CharacterController>(); control.center = new Vector3(0, 1, 0); control.height = 2; control.radius = 0.23f; #endregion #region 添加动画 PlayerIdel playerIdel = new PlayerIdel(animator); fsmManager.AddState(playerIdel); PlayerWalk playerWalk = new PlayerWalk(animator); fsmManager.AddState(playerWalk); PlayerRun playerRun = new PlayerRun(animator); fsmManager.AddState(playerRun); PlayerAttack playerAttack = new PlayerAttack(animator); fsmManager.AddState(playerAttack); PlayerAttacked playerAttacked = new PlayerAttacked(animator, this); fsmManager.AddState(playerAttacked); PlayerDie playerDie = new PlayerDie(animator); fsmManager.AddState(playerDie); #endregion }
// Use this for initialization void Start () { //at the beginning, no click action. //set the target position as the current position targetPosition = transform.position; //get the PlayerWalk.cs component playerWalk = this.GetComponent<PlayerWalk> (); attack = this.GetComponent<PlayerAttack> (); }
private void Awake() { PlayerReferences PlayerRefs = gameObject.GetComponentInParent <PlayerReferences>(); m_PlayerClimb = PlayerRefs.playerClimb; m_PlayerWalk = PlayerRefs.playerWalk; m_RigRigidbody = PlayerRefs.rigRigidbody; }
void InitializeComponents() { m_PlayerState = m_Instance.GetComponent <PlayerState>(); m_PlayerWalk = m_Instance.GetComponent <PlayerWalk>(); m_PlayerAction = m_Instance.GetComponent <PlayerAction>(); m_PlayerChargeUI = m_Instance.GetComponent <PlayerChargeUI>(); m_CanvasGameObject = m_Instance.GetComponentInChildren <Canvas>().gameObject; }
void Start() { startTime = Time.time; hitObjectText = GameObject.Find("Timer").GetComponent(typeof(Text)) as Text; timer = GameObject.Find("Timer").GetComponent(typeof(CountdownTimer)) as CountdownTimer; walk = GameObject.Find("Player").GetComponent(typeof(PlayerWalk)) as PlayerWalk; cameraSwitcher = GameObject.Find("floor").GetComponent(typeof(PlayerOrientation)) as PlayerOrientation; }
void Awake(){ walk = this.GetComponent<PlayerWalk> (); ps = this.GetComponent<PlayerStatus> (); hudtextFollow = transform.Find ("HUDText").gameObject; foreach (GameObject go in efxArray) { efxDict.Add(go.name,go); } }
// Use this for initialization void Awake() { lookUpAC = AnimateTiledConfig.getByName(gameObject, EnumAnimateTiledName.LookUpwards, true); dirSign = 0f; walk = GetComponent <PlayerWalk>(); // since we cannot create an instance from a MonoBehaviour then do next tempConfig = gameObject.AddComponent <PlayerFollowerXYConfig>(); // disable the dummy component from being updated by Unity3D game loop tempConfig.enabled = false; }
private void Awake() { walkController = player.GetComponent <PlayerWalk>(); dashController = player.GetComponent <PlayerDash>(); jumpController = player.GetComponent <PlayerJump>(); fireController = player.GetComponent <PlayerFire>(); thisTransform = gameObject.GetComponent <Transform>(); energy = player.GetComponent <EnergyController>(); playerBody = player.GetComponent <Rigidbody2D>(); sprite = GetComponent <SpriteRenderer>(); sounds = GetComponent <Sounds>(); }
// Use this for initialization void Start() { fsmManager = new FSMManager((int)AnimationEnum.Max); Animator animator = GetComponent <Animator>(); PlayerWait tmpWait = new PlayerWait(animator); fsmManager.AddState(tmpWait); PlayerJump tmpJump = new PlayerJump(animator, this); fsmManager.AddState(tmpJump); PlayerWalk tmpWalk = new PlayerWalk(animator); fsmManager.AddState(tmpWalk); PlayerWait02 tmpWait02 = new PlayerWait02(animator); fsmManager.AddState(tmpWait02); }
/// <summary> /// Setup the state machine. /// </summary> protected override void MakeFSM() { base.MakeFSM(); PlayerWalk walk = new PlayerWalk(StateID.Walk, this); walk.AddTransition(Transition.DestinationReached, StateID.Idle); walk.AddTransition(Transition.FoundPlayer, StateID.Finished); PlayerIdle idle = new PlayerIdle(StateID.Idle, this); idle.AddTransition(Transition.WalkToDestination, StateID.Walk); idle.AddTransition(Transition.FoundPlayer, StateID.Finished); PlayerFinished finished = new PlayerFinished(StateID.Finished, this.gameObject); fsm.AddState(walk); fsm.AddState(idle); fsm.AddState(finished); }
private void initialize() { jump = GetComponent <Jump>(); walk = GetComponent <PlayerWalk>(); firePivot = transform.FindChild("FirePivot"); teleportable = GetComponent <Teleportable>(); dieAnim = GetComponent <PlayerDieAnim>(); crouch = GetComponent <Crouch>(); idle = GetComponent <Idle>(); lookDirections = GetComponent <LookDirections>(); body = GetComponent <ChipmunkBody>(); rightFireDir.x = 1f; rightFireDir.y = -0.5f; leftFireDir.x = -1f; leftFireDir.y = -0.5f; fireDir = rightFireDir; collisionGroupSkip = GetComponent <ChipmunkShape>().collisionGroup; // not sure if ok: all layers except Player's layer collisionLayersSkip = unchecked ((uint)(1 << KLayers.PLAYER)); //collisionLayers = 0; }
// Use this for initialization void Start() { playerWalk = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerWalk>(); }
private void Start() { pw = GetComponent <PlayerWalk>(); normalMax = pw.GetVelMax(); }
// Use this for initialization void Start () { //get the component PlayerWalk.cs walk = this.GetComponent<PlayerWalk>(); attack = this.GetComponent<PlayerAttack> (); }
/// <summary> /// Is called every time an object is colliding. /// Help to keep in check the surrounding environment of the block. /// </summary> /// <param name="collision"></param> public void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Player" ) { // Check if the colliding object is the player player = collision.gameObject.GetComponent("PlayerWalk") as PlayerWalk ; // Get the player Object direction = player.getLastInput(); // Allow us to know in which direction the player wanted to go // For each direction we check: // -if the player was going in this direction // -if the block has an "solid" object next to him in this direction // if the two conditions are true then it call fonctBlocDestruction() because the block is blocked // else if neitheir is true it send the block in the direction the player wanted to if (direction == "right" && right ){ fonctBlocDestruction(); } else if (direction == "left" && left){ fonctBlocDestruction(); } else if (direction == "up" && up){ fonctBlocDestruction(); } else if (direction == "down" && down){ fonctBlocDestruction(); } else{ moving = true; } } else if (collision.gameObject.tag == "Enemy" ){ // Check if the colliding object is an ennemy if (moving == true){ // If the block is moving it destroys the ennemy else it doesn't do anything fonctCollisionDestruction(collision); } } else { // If it isn't the player or an ennemy ist check if our block is moving, if it's moving it check if it's colliding with a "solid" object // If it is, the block stop itself Else it continue sliding fonctCollisionEnter(collision); if (moving == true) { if ((collisionposition.x > position.x) && (collisionposition.y == position.y) && (direction == "right")) { direction = null; moving = false; target.x = Mathf.Round(transform.position.x); } if ((collisionposition.x < position.x) && (collisionposition.y == position.y) && (direction == "left")) { direction = null; moving = false; target.x = Mathf.Round(transform.position.x); } if ((collisionposition.y > position.y) && (collisionposition.x == position.x) && (direction == "up")) { direction = null; moving = false; target.y = Mathf.Round(transform.position.y); } if ((collisionposition.y < position.y) && (collisionposition.x == position.x) && (direction == "down")) { direction = null; moving = false; target.y = Mathf.Round(transform.position.y); } } } }
private void Awake() { pw = GetComponent <PlayerWalk>(); }
private void Start() { playerWalk = GetComponent <PlayerWalk> (); rb = GetComponent <Rigidbody2D> (); }
/// <summary> /// Plays a single playerwalk sound effect. /// </summary> public static void NewPlayerWalk() { PlayerWalk.Play(); }
private PlayerWalk playerCtrl; // Reference to the PlayerControl script. void Awake() { // Setting up the references. animator = transform.root.gameObject.GetComponent<Animator>(); playerCtrl = transform.root.GetComponent<PlayerWalk>(); }
void Start() { pw = GetComponent <PlayerWalk>(); rb = GetComponent <Rigidbody2D>(); scriptGroundCheck = objectGroundCheck.GetComponent <GroundCheck>(); }
void Start() { walkScript = GetComponent <PlayerWalk>(); pawnController = GetComponentInChildren <PlayerPawnController>(); }
void Start() { playerWalk = GetComponent <PlayerWalk>(); }