// Use this for initialization void Awake() { myBody = GetComponent <Rigidbody>(); playerAnim = GetComponent <PlayerAnimation>(); bgScroller = GameObject.Find(Tags.BACKGROUND_OBJ).GetComponent <BGScroller>(); playerShoot = GetComponent <PlayerHealthDamageShoot>(); }
// Start is called before the first frame update void Start() { _rigid = GetComponent <Rigidbody2D>(); _playerAnimation = GetComponent <PlayerAnimation>(); _playerSprite = GetComponentInChildren <SpriteRenderer>(); _swordArcSprite = transform.GetChild(1).GetComponent <SpriteRenderer>(); }
void Start() { manager = GameObject.Find("GameManager").GetComponent <GameManager> (); if (tag == PLAYER1_TAG) { knifeFeeback = GameObject.Find("Blue Knife").GetComponent <KnifeFeedback> (); playerWin = GameObject.Find("Player 1 Wins").GetComponent <PlayerWins> (); } else { knifeFeeback = GameObject.Find("Red Knife").GetComponent <KnifeFeedback> (); playerWin = GameObject.Find("Player 2 Wins").GetComponent <PlayerWins> (); } sounds = GameObject.Find("Sounds").GetComponent <Sounds> (); selfCollider = GetComponent <CircleCollider2D> (); playerAnimation = GetComponent <PlayerAnimation> (); velUnit = manager.velUnit; cooldownTimer = manager.postMurderCooldown; placeInScreen(); winDanceMove = false; winDanceMoveTimer1 = 1.5f; winDanceMoveTimer2 = 4.0f; dancingAsWinner = false; playedWinningDrums = false; }
void Start() { controller = GetComponent<PlayerController>(); animationState = GetComponent<PlayerAnimation>(); characterController = GetComponent<CharacterController>(); audios = GetComponent<AudioSource>(); }
public KickAttackState(FSM <T> fsm, PlayerAnimation anim, T iI, T pI) { _fsm = fsm; _idleInput = iI; _punchInput = pI; _anim = anim; }
private void Start() { if (instance == null) { instance = this; } else if (instance != this) { Debug.LogError("Duplicate " + this.GetType().Name); Destroy(gameObject); } animator = GetComponent <Animator>(); health = maxHealth.GetIntValue(); focus = maxFocus.GetIntValue(); UpdateStats(); playerAnimation = GetComponent <PlayerAnimation>(); soundManager = GetComponent <SoundManager>(); InventoryManager.instance.AddItem(new ItemStack(meat.item, 1)); InventoryManager.instance.AddItemToSlot(new ItemStack(starterSword.item, 1), InventoryManager.instance.equipSlots[0]); InventoryManager.instance.AddItemToSlot(new ItemStack(starterShield.item, 1), InventoryManager.instance.equipSlots[1]); InventoryManager.instance.AddItemToSlot(new ItemStack(starterHelmet.item, 1), InventoryManager.instance.equipSlots[2]); InventoryManager.instance.AddItemToSlot(new ItemStack(starterChestplate.item, 1), InventoryManager.instance.equipSlots[3]); InventoryManager.instance.AddItemToSlot(new ItemStack(starterLeggings.item, 1), InventoryManager.instance.equipSlots[4]); InventoryManager.instance.AddItemToSlot(new ItemStack(starterBoots.item, 1), InventoryManager.instance.equipSlots[5]); InventoryManager.instance.AddItemToSlot(new ItemStack(starterNecklace.item, 1), InventoryManager.instance.equipSlots[6]); InventoryManager.instance.AddItemToSlot(new ItemStack(startedRing.item, 1), InventoryManager.instance.equipSlots[7]); }
// Start is called before the first frame update void Start() { rbody = GetComponent <Rigidbody2D>(); boxCollider2d = GetComponent <BoxCollider2D>(); playerPos = GetComponent <Transform>(); playerAnimation = GetComponent <PlayerAnimation>(); }
private void Start() { // Saving component references to improve performance. m_Transform = GetComponent <Transform>(); controller = GetComponent <CharacterController>(); // Setting initial values. currentSpeed = moveSpeed; rayDistance = controller.height * .5f + controller.radius; slideLimit = controller.slopeLimit - .1f; jumpTimer = antiBunnyHopFactor; DOTween.Init(); standHeight = controller.height; bodyTransformOriginalScale = bodyTransform.localScale; playerAnimation = GetComponent <PlayerAnimation>(); playerScript = GetComponent <Player>(); headMouseLook = playerScript.body.headMouseLook; Height = controller.height; targetHeight = controller.height; }
//set all info from props //set detectGround public void Awake( ) { rb = GetComponent <Rigidbody2D> ( ); detectGround = transform.Find("Foot"); anim = GetComponent <PlayerAnimation> ( ); numNowJump = 0; }
// Start is called before the first frame update void Start() { _rg = GetComponent <Rigidbody2D>(); _Movedirection = GetComponent <PlayerAnimation>(); Health = 8; }
//void Awake() void Awake() { damegeTextManager = GameObject.FindGameObjectWithTag("DamageText").GetComponent <DamageTextManager>(); smallFood_Setting = GameObject.FindGameObjectWithTag("SmallMenu_Setting").GetComponent <SmallFood_Setting>(); smallStageMenu_Setting = GameObject.FindGameObjectWithTag("SmallStageMenu_Setting").GetComponent <SmallStageMenu_Setting>(); mainFood_Setting = GameObject.FindGameObjectWithTag("MainFood_Setting").GetComponent <MainFood_Setting>(); combo_system = GameObject.FindGameObjectWithTag("Combo_System").GetComponent <Combo_System>(); stage = GameObject.FindGameObjectWithTag("Stage").GetComponent <StageManager>(); layerMask = LayerMask.GetMask(DishLayer, SkillLayer); startSmallFoodAnimation = GameObject.FindGameObjectWithTag("StartSmallFoodPosition").GetComponent <StartSmallFoodAnimation>(); mainSpoonAnimation = GameObject.FindGameObjectWithTag("MainSpoon").GetComponent <MainSpoonAnimation>(); mainChopsticAnimation = GameObject.FindGameObjectWithTag("MainChopstic").GetComponent <MainChopsticAnimation>(); SmallSpoonAnimation = GameObject.FindGameObjectWithTag("SmallSpoonAnimation").GetComponent <SmallSpoonAnimation>(); mainForksAnimation = GameObject.FindGameObjectWithTag("MainForks").GetComponent <MainForksAnimation>(); mainKnifeAnimation = GameObject.FindGameObjectWithTag("MainKnife").GetComponent <MainKnifeAnimation>(); blueDishGather = GameObject.FindGameObjectWithTag("Blue_Dish_Gather").GetComponent <BlueDishGather>(); yellowDishGather = GameObject.FindGameObjectWithTag("Yellow_Dish_Gather").GetComponent <YellowDishGather>(); greenDishGather = GameObject.FindGameObjectWithTag("Green_Dish_Gather").GetComponent <GreenDishGather>(); redDishGather = GameObject.FindGameObjectWithTag("Red_Dish_Gather").GetComponent <RedDishGather>(); playerAnimation = GameObject.FindGameObjectWithTag("PlayerRender").GetComponent <PlayerAnimation>(); smallChopsticAnimation = GameObject.FindGameObjectWithTag("SmallChopstic").GetComponent <SmallChopsticAnimation>(); smallForksAnimation = GameObject.FindGameObjectWithTag("SmallForks").GetComponent <SmallForksAnimation>(); smallKnifeAnimation = GameObject.FindGameObjectWithTag("SmallKnife").GetComponent <SmallKnifeAnimation>(); mainCamara = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <MainCamara>(); stt = GameObject.FindGameObjectWithTag("STI").GetComponent <SustainmentTime>(); }
private void Awake() { if (Instance == null) { Instance = this; } }
public Player(Level pLevel) : base("assets/sprites/playerhitbox.png") { //Sprite Initialization SetOrigin(width / 2, height / 2); SetScaleXY(0.5f, 0.5f); //Timer initialization _lastUpdatedScoreTime = 0; _lastUpdatedEnergyTime = 0; //Enemy Collision variables initialization _isHit = false; _hit = 0; //Level Initialization _level = pLevel; //Initialization of other variables speed = STARTING_SPEED; score = 0; energy = MAX_ENERGY; startingPoopCost = 10; poopCost = startingPoopCost; birdKillPoints = SCORE_PER_KILL; canPoop = true; canKill = false; _playerAnimation = new PlayerAnimation(this); AddChild(_playerAnimation); }
/// <summary> /// 通知播放骰子动画 /// </summary> public void NotifyPlayDiceAnim(int num, Action diceAnimEnd) { _isThrow = false; DiceAnimEnd = diceAnimEnd; string animName = string.Empty; switch (num) { case 1: animName = "DiceNum1"; break; case 2: animName = "DiceNum2"; break; case 3: animName = "DiceNum3"; break; case 4: animName = "DiceNum4"; break; case 5: animName = "DiceNum5"; break; case 6: animName = "DiceNum6"; break; default: animName = "DiceNum3"; break; } PlayerAnimation.SetTrigger("IsThrow"); PlayerAnimation.SetTrigger(animName); }
public void previewCharacter(PlayerData.Character prCharacter) { // UI Detail characterName.GetComponent <Text>().text = prCharacter.GetCharacterName(); characterMoney.GetComponent <Text>().text = prCharacter.GetMoney() + ""; string detail = ToThaiJob(prCharacter.GetJob()) + "\r\n" + prCharacter.GetLevel() + "\r\n" + prCharacter.GetHP() + "/" + prCharacter.GetMaxHP() + "\r\n" + prCharacter.GetSP() + "/" + prCharacter.GetMaxSP() + "\r\n" + prCharacter.GetEXP() + "\r\n" + prCharacter.GetATK() + "\r\n" + prCharacter.GetDEF() + "\r\n"; characterDetail.GetComponent <Text>().text = detail; // Active preview character transform.GetChild(2).gameObject.SetActive(true); PlayerAnimation pa = transform.GetChild(2).GetComponent <PlayerAnimation>(); pa.genderData = prCharacter.GetGender(); pa.jobData = prCharacter.GetJob(); pa.hairData = prCharacter.GetHeadEquipment(); pa.clothData = prCharacter.GetBodyEquipment(); pa.shoeData = pa.clothData; selectCharacter = prCharacter; //Detail uiChoose.transform.GetChild(1).gameObject.SetActive(true); //Confirm button uiChoose.transform.GetChild(2).gameObject.SetActive(true); //Create button uiChoose.transform.GetChild(3).gameObject.SetActive(false); //Delete button //uiChoose.transform.GetChild(4).gameObject.SetActive(true); }
private void PlayAnim(PlayerAnimation anim) { if (_spritemap.CurrentAnim != anim) { _spritemap.Play(anim); } }
/** * <summary> * Will be called at the start of the game. * Gets the rigid body of the player and stores it. * Applies the player config to the states. * </summary> */ private void Start() { this.rb = GetComponent <Rigidbody2D>(); this.playerAnimation = this.GetComponent <PlayerAnimation>(); this.playerStatusManager = this.GetComponent <PlayerStatus>(); var inputController = this.CreateInputController(); this.playerAnimation.inputController = inputController; foreach (State state in this.states.Values) { state.Init(inputController, this.rb, this.playerStatusManager); } var magicSystemController = this.GetComponent <MagicSystemController>(); magicSystemController.inputController = inputController; this.playerStatus = this.GetComponent <PlayerStatus>(); this.playerStatus.inputController = inputController; this.playerStatus.Init( this.isLocalPlayer ? PlayerStatus.InitStatus.PLAYER_ONE : this.hasAuthority ? PlayerStatus.InitStatus.PLAYER_TWO : PlayerStatus.InitStatus.UNKNOWN ); if (this.hasAuthority) { this.CmdSpawnSpirits(!this.isLocalPlayer); } this.ApplyConfig(); }
void Start() { player_anim = GetComponentInChildren <PlayerAnimation>(); _rb = GetComponent <Rigidbody>(); _player = GetComponent <Player>(); _fsm = new FSM <string>(); _healthUI = gameObject.GetComponentInChildren <HealthUI>(); IdleState <string> idle = new IdleState <string>(_fsm, player_anim, "Move", "Punch Attack", "Kick Attack"); MoveState <string> move = new MoveState <string>(_player, _fsm, player_anim, "Attack", "Idle"); //JumpState<string> jump = new JumpState<string>(_fsm, "Idle", _rb, _player); PunchAttackState <string> punchAttack = new PunchAttackState <string>(_fsm, player_anim, "Idle", "Kick Attack"); KickAttackState <string> kickAttack = new KickAttackState <string>(_fsm, player_anim, "Idle", "Punch Attack"); idle.AddTransition("Move", move); idle.AddTransition("Punch Attack", punchAttack); idle.AddTransition("Kick Attack", kickAttack); move.AddTransition("Idle", idle); move.AddTransition("Punch Attack", punchAttack); move.AddTransition("Kick Attack", kickAttack); //jump.AddTransition("Idle", idle); punchAttack.AddTransition("Idle", idle); punchAttack.AddTransition("Kick Attack", kickAttack); kickAttack.AddTransition("Idle", idle); kickAttack.AddTransition("Punch Attack", punchAttack); _fsm.SetInit(idle); }
// -------------------------------------------------------------------------------- // Methods // -------------------------------------------------------------------------------- void Start() { _rB2D = GetComponent <Rigidbody2D>(); _bC2D = GetComponent <BoxCollider2D>(); _playerAnimation = GetComponent <PlayerAnimation>(); _playerSprite = GetComponentInChildren <SpriteRenderer>(); }
private void CalculateVelocity() { Vector3G vector3G = new Vector3G(); double num = (double)Time.time - (double)this.lastVelocityCalc; Character character = base.idMain; Vector3 vector3 = (!character ? base.transform.position : character.origin); Vector3G vector3G1 = new Vector3G(ref vector3); double num1 = 1 / num; vector3G.x = num1 * (vector3G1.x - this.lastPosPrecise.x); vector3G.y = num1 * (vector3G1.y - this.lastPosPrecise.y); vector3G.z = num1 * (vector3G1.z - this.lastPosPrecise.z); Matrix4x4G matrix4x4G = new Matrix4x4G(base.transform.worldToLocalMatrix); Matrix4x4G.Mult3x3(ref vector3G, ref matrix4x4G, out this.localVelocityPrecise); this.lastVelocityCalc = Time.time; this.speedPrecise = Math.Sqrt(this.localVelocityPrecise.x * this.localVelocityPrecise.x + this.localVelocityPrecise.z * this.localVelocityPrecise.z); if (this.speedPrecise >= (double)this.movement.configuration.minMoveSpeed) { double num2 = 1 / this.speedPrecise; this.movementNormalPrecise.x = (double)this.localVelocity.x * num2; this.movementNormalPrecise.y = (double)this.localVelocity.z * num2; double num3 = this.anglePrecise; this.anglePrecise = Math.Atan2(this.movementNormalPrecise.x, this.movementNormalPrecise.y) / 3.14159265358979 * 180; float single = this.movement.configuration.maxTurnSpeed; if (single > 0f && this.anglePrecise != num3 && this.lastAngleSpeedPrecise >= 0.05) { double num4 = (double)Time.deltaTime * (double)single; if (Precise.MoveTowardsAngle(ref num3, ref this.anglePrecise, ref num4, out this.anglePrecise)) { double num5 = this.anglePrecise / 180 * 3.14159265358979; this.movementNormalPrecise.x = Math.Sin(num5); this.movementNormalPrecise.y = Math.Cos(num5); } } this.lastAngleSpeedPrecise = this.speedPrecise; } else { this.speedPrecise = 0; this.movementNormalPrecise.x = 0; this.movementNormalPrecise.y = 0; if (this.lastAngleSpeedPrecise > 0) { float single1 = this.movement.configuration.maxTimeBetweenTurns; float single2 = single1; if (single1 > 0f) { PlayerAnimation playerAnimation = this; playerAnimation.lastAngleSpeedPrecise = playerAnimation.lastAngleSpeedPrecise - (double)(Time.deltaTime / single2); } } } this.lastPosPrecise = vector3G1; this.lastPos = vector3; this.movementNormal = this.movementNormalPrecise.f; this.speed = (float)this.speedPrecise; this.angle = (float)this.anglePrecise; this.localVelocity = this.localVelocityPrecise.f; }
// Use this for initialization void Start() { animationController = new PlayerAnimation(gameObject); hotbarButtons = GameObject.FindGameObjectsWithTag("HotbarButton"); foreach (var button in hotbarButtons) { var component = button.GetComponent <Button>(); var mohb = button.GetComponent <MouseOverHotbarButton>(); if (mohb == null) { continue; } if (mohb.number == 12) { continue; } component.onClick.AddListener(() => AssignMouseToHotbarButton(mohb.number)); if (button.GetComponent <RightClickHandler>() != null) { button.GetComponent <RightClickHandler>().onClick = () => AssignAltMouseToHotbarButton(mohb.number); } } inputs = new Dictionary <string, Action>() { ["SwitchTarget"] = SwitchTarget, ["Cancel"] = ClearWindows, ["Use Item"] = UseWorldObject, ["Character Sheet"] = ToggleCharacterSheet, ["Inventory"] = ToggleInventory, ["Ability Menu"] = ToggleAbilityMenu }; }
// Use this for initialization void Start() { //assign handle for rigidbody _rigid = GetComponent <Rigidbody2D>(); //assign handle to playeranimation _anim = GetComponent <PlayerAnimation>(); }
private void Awake() { elementNames.Add("Ice"); elementNames.Add("Fire"); elementNames.Add("Lightning"); elementConversion.Add("Ice", 0); elementConversion.Add("Fire", 1); elementConversion.Add("Lightning", 2); for (int i = 0; i < 3; i++) { Orb orb = new Orb(); Element elem = new Element(); elem.Name = elementNames[i]; orb.Type = elem; orbInventory.Add(elementNames[i], 0); } oc = GetComponent <OrbController>(); player = GetComponent <Player>(); pUI = GameObject.FindGameObjectWithTag("uiManager").GetComponent <PlayerUI>(); pAnim = GetComponent <PlayerAnimation>(); oAud = GameObject.FindGameObjectWithTag("OrbUse").GetComponent <OrbUse>(); opAud = GameObject.FindGameObjectWithTag("OrbPickUp").GetComponent <OrbPickUp>(); pPart = GetComponent <PlayerParticles>(); }
protected void Start() { m_animationComponent = GetComponent <PlayerAnimation>(); Debug.Assert(m_animationComponent != null, "Error: el componente animacion no existe"); m_animationComponent.RegisterOnAnimationEvent = OnAnimationFinish; SendMessage("OnChangeWeapon", m_activeWeapon, SendMessageOptions.DontRequireReceiver); // TODO 1 : Registramos RegisterChangeWeapon en el input controller del inputmgr con el event ChangeWeapon //Cogemos el inputmgr InputMgr inputMgr = GameMgr.GetInstance().GetServer <InputMgr>(); Debug.Assert(inputMgr != null, "Error: el componente InputMgr no existe"); //Cogemos el controlador del pointAndClick PointAndClickInput m_pointInput = inputMgr.GetInput <PointAndClickInput>(); Debug.Assert(m_pointInput != null, "Error: el componente PointAndClickInput no existe"); //Registramos ChangeeWeapon en el m_pointController m_pointInput.RegisterChangeWeapon(this.ChangeWeapon); foreach (TWeapons wp in m_weapons) { wp.gameObject.SetActive(false); } m_weapons[m_activeWeapon].gameObject.SetActive(true); m_animationComponent.ChangeOverrideAnimatorController(m_weapons[m_activeWeapon].AnimationController); }
private void Start() { Bullet.damage = 1; rb = GetComponent <Rigidbody2D>(); sprite = GetComponent <SpriteRenderer>(); anim = GetComponent <PlayerAnimation>(); }
private void Start() { animator_Input = GetComponent <PlayerAnimation>(); move_Input = GetComponent <PlayerMove>(); shoot_Input = GetComponent <PlayerShoot>(); weapon_Input = GetComponent <ReWeapon>(); }
// Use this for initialization void Start() { if (pl == null) { pl = FindObjectOfType <PlayerAnimation>(); } }
public PunchAttackState(FSM <T> fsm, PlayerAnimation anim, T iI, T kI) { _fsm = fsm; _idleInput = iI; _kickInput = kI; _anim = anim; }
/// <summary> /// Use this for initialisation. /// </summary> void Start() { m_transform = gameObject.GetComponent <Transform>(); if (!m_transform) { Debug.LogError("Could not find component Transform"); } m_rigidbody = gameObject.GetComponent <Rigidbody2D>(); if (!m_rigidbody) { Debug.LogError("Could not find component Rigidbody2D"); } m_playerInput = gameObject.GetComponent <PlayerInput>(); if (!m_playerInput) { Debug.LogError("Could not find component PlayerInput"); } m_playerAnimation = gameObject.GetComponent <PlayerAnimation>(); if (!m_playerAnimation) { Debug.LogError("Could not find component PlayerAnimation"); } m_playerRotation = gameObject.GetComponent <PlayerRotation>(); if (!m_playerRotation) { Debug.LogError("Could not find component PlayerRotation"); } m_gameManager = GameObject.FindObjectOfType <GameManager>(); if (!m_gameManager) { Debug.LogError("Could not find component GameManager"); } }
// Start is called before the first frame update void Start() { _rigidbody2D = GetComponent <Rigidbody2D>(); _playerAnimation = GetComponent <PlayerAnimation>(); _spriteRender = GetComponentInChildren <SpriteRenderer>(); _swordEffectGO = transform.GetChild(1).gameObject; }
// Use this for initialization void Start () { playerManager = GetComponent<PlayerManager>(); playerAttack = GetComponent<PlayerAttack>(); playerAnimation = GetComponent<PlayerAnimation>(); rigidBody = GetComponent<Rigidbody>(); trans = GetComponent<Transform>(); }
// Use this for initialization void Start () { animationScript = GetComponent<PlayerAnimation> (); jumpScript = GetComponent<PlayerJump> (); localSpriteRenderer = GetComponent<SpriteRenderer> (); scoreScript = GetComponent<TheScoreSystem> (); currentHealth = maxHealth; healthUIScript = gameUI.GetComponent<UIHealth> (); }
// Use this for initialization void Start () { animationScript = GetComponent<PlayerAnimation> (); playerRigid = GetComponent<Rigidbody2D> (); inputScript = GetComponent<PlayerInput> (); if (holdJump) { inputScript.activateOnHoldJumping (maxHoldTime); jumpHeigt = singleJumpForce; } }
void Start() { playerAnimation = TranscriptManager._instance.Player.GetComponent<PlayerAnimation>(); if(transform.Find("Mask")) { maskSprite = transform.Find("Mask").GetComponent<UISprite>(); } btn = this.GetComponent<UIButton>(); this.collider = this.GetComponent<BoxCollider>(); }
void Start(){ playerAnimation = TranscriptManager._instance.player.GetComponent<PlayerAnimation> (); if(transform.Find("Mask")){ maskSprite = transform.Find ("Mask").GetComponent<UISprite> (); } btn = this.GetComponent<UIButton> (); // mask1Sprite = transform.parent.Find ("Skill1").GetComponentInChildren<UISprite> (); // mask2Sprite = transform.parent.Find ("Skill2").GetComponentInChildren<UISprite> (); // mask3Sprite = transform.parent.Find ("Skill3").GetComponentInChildren<UISprite> (); }
public void InitPlayerAnimation() { GameObject player = Instantiate( playerPrefs[playerStatus.playerID-1] ) as GameObject; playerAnimation = player.GetComponent<PlayerAnimation>(); player.transform.parent = transform; player.transform.localScale = Vector3.one ; player.transform.localPosition = initOffset; transform.localScale *= animationScale; }
public virtual void Start() { gameManager = GameManager.instance; playerAnimation = PlayerController.instance.GetComponent<PlayerAnimation>(); startLayer = gameObject.layer; if (destructionAnimation && isDestructible) { destructionAnimation[destructionAnimationName].wrapMode = WrapMode.Once; destructionDelay = new WaitForSeconds(0.2f); } collideWithPlayer = true; }
//player not in owner, lose control public void LoseControl() { motor = this.GetComponent<CharacterMotor> (); playerAnimation = this.GetComponent<PlayerAnimation> (); camera.gameObject.SetActive (false); //negative camera motor.canControl = false; //negative motion control playerAnimation.enabled = false; //negative animation xMouseLook.enabled = false; //negative mouse look yMouseLook.enabled = false; // soilder.GetComponent<MouseLook> ().enabled = false; // soilderSpine2.GetComponent<MouseLook> ().enabled = false; bulletGenerator.enabled = false; //negative bullet generating }
// Use this for initialization void Start () { playerAnimation = GetComponentInParent<PlayerAnimation> (); weaponTrigger = GetComponent<BoxCollider2D> (); AudioSource[] sounds = GetComponentsInChildren<AudioSource> (); m_NormalAttackSounds = new List<AudioSource> (); m_GodAttackSounds = new List<AudioSource> (); foreach (AudioSource sound in sounds) { if (sound.tag == "NormalAttack") m_NormalAttackSounds.Add (sound); if (sound.tag == "GodAttack") m_GodAttackSounds.Add (sound); } }
public void PlayAnimation(PlayerAnimation aAnimation, bool aState = true) { switch (aAnimation) { case PlayerAnimation.COMMAND: m_Animator.SetBool(ConstValues.PLAYER_ANIMATION_COMMAND, aState); break; case PlayerAnimation.DEATH: m_Animator.SetBool(ConstValues.PLAYER_ANIMATION_DEATH, aState); break; case PlayerAnimation.FALL: m_Animator.SetBool(ConstValues.PLAYER_ANIMATION_FALL, aState); break; default: Debug.Log("Invalid animation enum."); break; } }
// Use this for initialization void Start () { _camera.SetActive(true); command = GetComponent<PlayerCommand>(); mainBomb = GetComponent<MainBomb>(); pa = GetComponent<PlayerAnimation>(); //gamePlay = GameObject.Find("Scripts").GetComponent<GamePlay>(); //hit = GameObject.Find ("CheckHit"); //hit.SetActive(false); Transform controller = GameObject.Find("Controller").transform; // forwardGO = controller.GetChild(0).gameObject; // backwardGO = controller.GetChild(1).gameObject; // leftGO = controller.GetChild(2).gameObject; // rightGO = controller.GetChild(3).gameObject; // bombGO = controller.GetChild(4).gameObject; forwardAnim = controller.GetChild(0).GetComponent<Animator> (); backwardAnim = controller.GetChild(1).GetComponent<Animator> (); leftAnim = controller.GetChild(2).GetComponent<Animator> (); rightAnim = controller.GetChild(3).GetComponent<Animator> (); BombAnim = controller.GetChild(4).GetComponent<Animator> (); }
void Start() { DateTime now=DateTime.UtcNow; playerId="subject-"+now.ToString("yyMMddHHmm"); initialPos=transform.position; grapDetector = GetComponent<GrapDetector> (); ikControl=GetComponent<IKController>(); grapDetector.onObjectEnter+=onObjectDetectEnter; grapDetector.onObjectLeave+=onObjectDetectLeave; select=GameObject.Find("SceneLogic").GetComponent<SelectController>(); kinectModelController = GetComponent<KinectModelControllerV2> (); playerAni=GetComponent<PlayerAnimation>(); bool isKinectInited= KinectSensor.IsInitialized; monoInput=GetComponent<MonoController>(); wiiInput=GetComponent<WiiController>(); if(controlType==ControlType.mono){ monoInput.enabled=true; wiiInput.enabled=false; grapDetector.target = corsor; main.depth=10; //qr.gameObject.SetActive(false); }if(controlType==ControlType.stereo){ // if(GameObject.Find ("SceneLogic").GetComponent<ClienTest>().isServer){ // monoInput.enabled=true; // wiiInput.enabled=false; // }else // { // monoInput.enabled=true; // wiiInput.enabled=true; // } grapDetector.target = hand; main.depth=-50; } }
void Start () { _rigidbody = GetComponent<Rigidbody2D> (); playerAnimation = GetComponent<PlayerAnimation> (); }
void Start() { _playerAttack = transform.parent.GetComponent<PlayerAttack>(); _playerAnimation = transform.parent.GetComponent<PlayerAnimation>(); }
// Use this for initialization void Start() { animator = GetComponentInChildren<PlayerAnimation>(); kolajnice = GameObject.FindGameObjectWithTag("KolajniceTag").GetComponent<Kolajnice>(); jumpDistance = kolajnice.sideDistance; targetPosition = transform.localPosition; startPosition = targetPosition; mPlayer = GameObject.FindGameObjectWithTag("MusicPlayer").GetComponent<MusicPlayer>(); }
void Awake() { playerAnimation = GameObject.FindGameObjectWithTag (Tags.player).GetComponent<PlayerAnimation> (); }
private void Start() { _playerAnimation = GetComponent<PlayerAnimation>(); }
// Use this for initialization void Start () { motor = this.GetComponent<CharacterMotor> (); playerAnimation = this.GetComponent<PlayerAnimation> (); }
public override void LoadContent() { ranks.LoadContent(game.Content); spriteBatch = new SpriteBatch(service.GraphicsDevice); // Create a new SpriteBatch, which can be used to draw textures. h1.LoadContent(game.Content); crosshair.LoadContent(game.Content); d1.LoadContent(game.Content); b1.initImage(game.Content); font = game.Content.Load<SpriteFont>("Font"); crosshair.Position = new Vector2((service.GraphicsDevice.PresentationParameters.BackBufferWidth / 2)+ 400, service.GraphicsDevice.PresentationParameters.BackBufferHeight / 2); vip = new VIP(crosshair.Position); vip.LoadContent(game.Content); sprite = new PlayerAnimation(); chopperAnimation = new AnimatedSprite(game.Content.Load<Texture2D>("Sprites/frontreel"), .15f, true); chopperAnimation.FrameDivisions = 3; chopperSound = game.Content.Load<SoundEffect>("Sounds\\Chopper").CreateInstance(); wm = new WaveManager(); wm.LoadContent(game.Content, crosshair, vip, service.GraphicsDevice.Viewport); // TODO: use this.Content to load your game content here }
public float tempSword10Stun; // Counter that determinates when the sword10 attack is going to stun the enemies. // Use this for initialization void Start () { playerManager = GetComponent<PlayerManager>(); playerAnimation = GetComponent<PlayerAnimation>(); playerController = GetComponent<PlayerController>(); }
private void AddFrame(PlayerAnimation animation, int cellIndex, int xoffset, int yoffset, bool mirrored) { PlayerFrame frame = new PlayerFrame(cellIndex, xoffset, yoffset, mirrored); m_animations[Animation_To_Index[animation]].Add(frame); }
// find aggregated objects void Awake() { #region check aggrigated classes/components if (input == null) { input = GetComponent<PlayerInput>(); } if (movement == null || myProperties.myMovement == null) { movement = GetComponent<PlayerMovement>(); movement.myOwner = this; myProperties.myMovement = movement; } if (playerAnimation == null) { playerAnimation = GetComponent<PlayerAnimation>(); } if (playerSounds == null) { playerSounds = transform.Find("Sounds").GetComponent<PlayerSounds>(); } if (circleGesture == null) { circleGesture = GetComponent<CircleGestureReader>(); } if (updateControllers == null || updateControllers.Length == 0) { updateControllers = GetComponentsInChildren<UpdateController>(); } if (punchCircle == null) { punchCircle = transform.Find("PunchUI").GetComponent<PunchCircle>(); } if (dashCircle == null) { dashCircle = transform.Find("Geometry/DashUI").GetComponent<CooldownUI>(); } if (stompCircle == null) { stompCircle = transform.Find("StompUI").GetComponent<CooldownUI>(); } if (col == null) { col = geometry.GetComponent<Collider>(); } // parent of the actual player model if (geometry == null) { geometry = transform.Find("Geometry"); } // get Animator from player geometry if (geometry != null && anim == null) { anim = geometry.GetComponentInChildren<Animator>(); } // get punch animation event if (anim != null && animEvents == null) { animEvents = anim.GetComponent<LivingAnimationEvents>(); } if (this.myProperties.myPerception == null) { this.myProperties.myPerception = this.GetComponent<Perception>(); this.myProperties.myPerception.myOwner = this; } if (this.myProperties.myAttack == null) { this.myProperties.myAttack = transform.Find("Attacks").GetComponent<PlayerAttack>(); } //this.myProperties.myTargetting = this.GetComponent<Targetting>(); //this.myProperties.myTargetting.myOwner = this; if (input == null || movement == null || playerAnimation == null || playerSounds == null|| anim == null || animEvents == null || col == null) { Debug.LogError("Key Component Missing on " + this); this.enabled = false; return; } if (myProperties.myAttack == null || myProperties.myPerception == null || circleGesture == null || punchCircle == null) { Debug.LogError("Attack Component Missing on " + this); this.enabled = false; return; } // CHARGE INPUT TYPE if (chargeType == ChargeType.Trigger && circleGesture != null) { circleGesture.enabled = false; } #endregion StartListening(); }
public void init() { // deprecated variables warnings: if (jumpForce != 0 && jumpHeight == 0) { Debug.LogError("PlayerController.jumpForce is deprecated. Use jumpHeight instead."); jumpHeight = jumpForce; } if (jumpDownwardForce != 0 && gravity == 0) { Debug.LogError("PlayerController.jumpDownwardForce is deprecated. Use gravity instead."); gravity = jumpDownwardForce; } // rigidbody should no longer use gravity, be kinematic, and freeze all constraints if (rigidbody != null) { if (rigidbody.useGravity) { Debug.LogError("The rigidbody no longer needs to use gravity. Disabling."); rigidbody.useGravity = false; } if (!rigidbody.isKinematic) { Debug.LogError("The rigidbody should be kinematic. Enabling."); rigidbody.isKinematic = true; } if (rigidbody.constraints != RigidbodyConstraints.FreezeAll) { Debug.LogError("The rigidbody should freeze all constraints. The PlayerController will take care of the physics."); rigidbody.constraints = RigidbodyConstraints.FreezeAll; } } cameraController = CameraController.instance; infiniteObjectGenerator = InfiniteObjectGenerator.instance; powerUpManager = PowerUpManager.instance; gameManager = GameManager.instance; if (attackType == AttackType.Projectile) { projectileManager = GetComponent<ProjectileManager>(); } platformLayer = 1 << LayerMask.NameToLayer("Platform"); floorLayer = 1 << LayerMask.NameToLayer("Floor"); wallLayer = LayerMask.NameToLayer("Wall"); obstacleLayer = LayerMask.NameToLayer("Obstacle"); thisTransform = transform; capsuleCollider = GetComponent<CapsuleCollider>(); playerAnimation = GetComponent<PlayerAnimation>(); playerAnimation.init(); startPosition = thisTransform.position; startRotation = thisTransform.rotation; slideData = new CoroutineData(); stumbleData = new CoroutineData(); forwardSpeeds.init(); // determine the fastest and the slowest forward speeds forwardSpeeds.getMinMaxValue(out minForwardSpeed, out maxForwardSpeed); forwardSpeedDelta = maxForwardSpeed - minForwardSpeed; if (forwardSpeedDelta == 0) { playerAnimation.setRunSpeed(1, 1); } // make sure the coin magnet trigger is deactivated activatePowerUp(PowerUpTypes.CoinMagnet, false); reset(); enabled = false; }
public void SetAnimation(PlayerAnimation animation) { if (m_currentAnimation != m_animations[AtoI(animation)]) { m_currentAnimation = m_animations[AtoI(animation)]; m_currentFrame = 0; m_timeSinceLastFrame = new TimeSpan(0); m_animationHasntChanged = false; } }
// Use this for initialization void Start() { _distanceToGround = collider.bounds.extents.y; _AnimPlayer = GetComponentInChildren<PlayerAnimation>(); }
public void setPlayerAnimation(PlayerAnimation _ani) { // if(aniState == _ani) // return; aniState = _ani; switch(aniState){ case PlayerAnimation.IDLE: anim.Play("T_idle"); break; case PlayerAnimation.WALK: anim.Play("T_walk"); break; case PlayerAnimation.ATTACK: anim.Play("T_attack"); break; } }
private int AtoI(PlayerAnimation animation) { return Animation_To_Index[animation]; }
// Use this for initialization new void Start() { base.Start(); useDefaultFreezing(false); if(gameRules != null) gameRules.RegisterPlayer(this); line = GetComponent<TrailRenderer>(); particles = GetComponent<ParticleSystem>(); playerAnim = GetComponentInChildren<PlayerAnimation>(); }
// Sets public void setAwake() { currentDashResistance = maxDashResistance; currentHealth = maxHealth; // Sets the player health to the value of maxHealth that you indicated. sword10Active = false; // Sets the sword10Active bool to false by default. //sword20Active = false; // Sets the sword20Active bool to false by default. chain10Active = false; // Sets the chain10Active bool to false by default. playerSphereCollider = GetComponent<SphereCollider>(); playerCapsuleCollider = GetComponent<CapsuleCollider>(); attack10Collider = GetComponentInChildren<BoxCollider>(); // Gets the BoxCollider of the PlaceHolder_Sword children. attack01ColliderRadius = attack01Collider.radius; playerAudio = GetComponent<AudioSource>(); // Gets the component AudioSource from the player. timeStunned = timeStunnedIni; flashColor = new Color(1.0f, 0.0f, 0.0f, 0.1f); // Sets the color values for the damageImage. swordSprite.enabled = true; chainSprite.enabled = false; sword10Sprite.enabled = false; sword20Sprite.enabled = false; chain10Sprite.enabled = false; swordMaterial = GetComponent<Renderer>().material; playerAttack = GetComponent<PlayerAttack>(); playerAnimation = GetComponent<PlayerAnimation>(); playerController = GetComponent<PlayerController>(); chainTransition = GetComponentInChildren<ChainAnimTrigger>(); anim = GetComponent<Animator>(); state = PlayerStates.AWAKE; // Cals the AWAKE state. }
void Start() { _controller = GetComponent<CharacterController>(); _playerAnimation = GetComponent<PlayerAnimation>(); }