private void Attack(GameTime gameTime) { if (attacking) { if (animationPlay && animationController.IsPlaying && activeAnimation != PlayerAnimations.Aim && activeAnimation != PlayerAnimations.Shoot) { activeAnimation = PlayerAnimations.Aim; animationController.LoopEnabled = false; playAnimation(); } else if ((!animationController.IsPlaying && activeAnimation == PlayerAnimations.Aim) || !animationPlay) { activeAnimation = PlayerAnimations.Shoot; animationController.LoopEnabled = false; playAnimation(); } else if (!animationController.IsPlaying && activeAnimation == PlayerAnimations.Shoot) { delay += (int)gameTime.ElapsedGameTime.TotalMilliseconds; if (delay > delayInterval) { delay -= delayInterval; shooting = true; num_of_attacks--; if (num_of_attacks == 0) { attacking = false; } } } } }
// Use this for initialization void Start() { _myRigidBody2D = GetComponent <Rigidbody2D>(); _playerAnimations = GetComponent <PlayerAnimations>(); _myCollider2D = GetComponent <Collider2D>(); Health = _health; }
// Use this for initialization void Start() { deaths = 0; player = gameObject.GetComponent <PlayerMovement>(); anim = gameObject.GetComponent <PlayerAnimations>(); respawn_Point = GameObject.Find("RespawnPoint").GetComponent <Respawn>(); }
void Start() { animations = new PlayerAnimations(this); //last_aim_direction=last_move_direction=Vector3.forward; legit_timer = new Timer(888, OnLegit); onGround_timer = new Timer(200, OnGroundTimer); mp_regen_timer = new Timer(stats.MP_regen_delay, OnMPregenTimer); hp = stats.HP; mp = stats.MP; if (regen_multi == -1) { mp = 0; } //Data set ability_containers = new List <AbilityContainer>(); for (int i = 0; i < Data.Abilities.Count; i++) { var abb = new AbilityContainer(this, Data.Abilities[i]); ability_containers.Add(abb); } _Color = Data.color; controllerNumber = Data.controllerNumber; //NotificationCenter.Instance.addListener(OnExplosion,NotificationType.Explode); NotificationCenter.Instance.addListener(OnKnockback, NotificationType.HaxKnockback); }
public void KillPlayer(GameObject unit, PlayerAnimations animation, bool play_death_effect) { if (!player_death) { player_death = true; player_unit = unit; player_movements = player_unit.GetComponent <PlayerMovements>(); player_movements.LockMovements(true); animator.SetAnimation(animation); player_movements.HealthBarVisibility(false); player_movements.SetPlayerHP(0); player_movements.ActivateSpeedBoost(false); if (play_death_effect) { SpawnPool general_pool = PoolManager.Pools[CurrentLevel.GetGeneralPoolName()]; general_pool.Spawn(death_effect, unit.transform.position, new Quaternion(0, 0, 0, 0)); } if (animation == PlayerAnimations.Death) { player_movements.StartCoroutine(DeathAnimation()); } else { player_movements.StartCoroutine(ResurrectPlayer(RESPAWN_TIMER)); } } }
void Death() { Transform t1 = transform.GetChild(1); SpriteRenderer sR = t1.GetComponent <SpriteRenderer>(); if (sR.sortingLayerName != "OverWallUp" && sR.sortingLayerName != "BehindWallUp") { sR.sortingLayerName = overBloodLayer; sR.sortingOrder = overBloodSortingOrder; } else { sR.sortingLayerName = overBloodUpLayer; sR.sortingOrder = overBloodSortingOrder; } PlayerAnimations anim = t1.GetComponent <PlayerAnimations>(); anim.Death(); t1.parent = null; Destroy(gameObject); }
public void Initialize() { //transform.position = spawnPos; controler = GetComponent <CharacterController>(); GM = GameObject.FindGameObjectWithTag("Managers").GetComponent <GameManager>(); anims = GetComponentInChildren <PlayerAnimations>(); HUD = GameObject.FindGameObjectWithTag("Managers").GetComponent <HudManager>(); items = GetComponentInChildren <Items>(); WM = GetComponentInChildren <WeaponManager>(); CC = GetComponent <CloseCombat>(); life = GetComponentInChildren <HealthPeace>(); itemDetector = items.GetComponent <ItemDetector>(); stealth = GetComponentInChildren <StealthSystem>(); IWM = GetComponentInChildren <ImprovedWeaponManager>(); speed = walkSpeed; cam = Camera.main; camTrans = cam.transform; dodgeSpeed = dodgeNormalModeSpeed; timeOfDodge = timeOfDodgeNormalMode; timeForCanDodge = timeForCanDodgeNormalMode; normalHeight = controler.height; charControllercenterOffset = (normalHeight - crouchHeight) / 2; LoadPlayer(); }
private void Start() { isJumping = false; playerAnim = GetComponent <PlayerAnimations>(); rb = GetComponent <Rigidbody2D>(); sprite = GetComponent <SpriteRenderer>(); }
// Use this for initialization void Start() { speed = regVelocity; player = GetComponent <CharacterController>(); anim = GetComponent <PlayerAnimations>(); }
void Awake() { shootableMask = LayerMask.GetMask("Shootable"); gunLine = GetComponent <LineRenderer>(); gunLight = GetComponent <Light>(); anim = transform.parent.parent.GetComponent <PlayerAnimations>(); }
// Use this for initialization void Start() { Inventory = GetComponent <PlayerInventory>(); anim = GetComponent <PlayerAnimations>(); FullAmmo(); SelectWeapon(0); }
//public bool detected = false; private void Awake() { GM = GetComponent <GameManager>(); checkpointsManager = GetComponent <CheckpointsManager>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>(); inputs = GameObject.FindGameObjectWithTag("Managers").GetComponent <ImputManager>(); camera = GameObject.FindGameObjectWithTag("TPCamera").GetComponent <CamaraAdjustment>(); playerAnims = player.GetComponentInChildren <PlayerAnimations>(); HUD = GetComponent <HudManager>(); weapon = player.GetComponentInChildren <WeaponManager>(); inv = GameObject.FindGameObjectWithTag("Inventory").GetComponentInChildren <Inventory>(); Items = player.GetComponentInChildren <Items>(); sound = GetComponent <SoundManager>(); peace = player.GetComponentInChildren <HealthPeace>(); CC = player.GetComponent <CloseCombat>(); //Hit = playerAnims.GetComponentInChildren<HitArea>(); itemDetector = Items.GetComponent <ItemDetector>(); throwImpact = player.GetComponentInChildren <ThrowImpact>(); stealth = player.GetComponent <StealthSystem>(); pauseMn = gameObject.GetComponent <PauseManager>(); IWM = player.GetComponentInChildren <ImprovedWeaponManager>(); Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; }
private void Awake() { playerAnimations = GetComponent <PlayerAnimations>(); uIManager = FindObjectOfType <UIManager>(); gameManager = FindObjectOfType <GameManager>(); camAnimations = FindObjectOfType <CamAnimations>(); }
private void Start() { rigid = GetComponent <Rigidbody2D>(); playerAnim = GetComponent <PlayerAnimations>(); playerSprite = GetComponentInChildren <SpriteRenderer>(); swordArcSprite = transform.GetChild(1).GetComponent <SpriteRenderer>(); }
void Start() { Status(); playerStock = PlayerData.Instance.playerStock; m_vector = Vector2.zero; PlayerData.Instance.SetJobTime = PlayerData.Instance.jobTime; m_playerInput = GetComponent <PlayerInput>(); cam = m_mainCamera.GetComponent <Camera>(); m_rigid2D = GetComponent <Rigidbody2D>(); m_playerAnimations = GetComponent <PlayerAnimations>(); animator = GetComponent <Animator>(); MainSpriteRenderer = GetComponent <SpriteRenderer>(); uiController = GameObject.Find("UiController").GetComponent <UiController>(); m_changePlayer = GameObject.Find("PlayerManager").GetComponent <ChangePlayer>(); //SoulShot soulShot = m_Soul.GetComponent<SoulShot>(); PlayerData.Instance.SetJobTime = PlayerData.Instance.jobTime; string JobName = m_job.ToString(); switch (m_job) { case PlayerJob.GeroZomie: uiController.ChangePlayerIcom(); break; //case TagName.gelozombie: //uiController.ChangePlayerIcom(gameObject.tag); //break; default: break; } m_jobTime = PlayerData.Instance.jobTime; }
// Use this for initialization void Start() { anim = GetComponent <Animation>(); gt = GetComponentInChildren <GroundTrigger> (); ct = GetComponentInChildren <CrawlTrigger> (); sr = GetComponent <SpriteRenderer>(); pa = GetComponent <PlayerAnimations>(); }
protected override void ActiveEffect() { Rigidbody2D rb = GetComponent <Rigidbody2D>(); PlayerAnimations pAnim = GetComponent <PlayerAnimations>(); float orientation = pAnim.LookingRight() ? 1 : -1; rb.velocity = new Vector2(orientation * range, 0); }
private void Awake() { playerAnimations = GetComponent <PlayerAnimations>(); InputManager.Instance.OnPickUpButtonPressed += PickUpOrDropObject; InputManager.Instance.OnThrowButtonPressed += ThrowObject; LevelManager.Instance.OnBeforeSceneLoad += UnsubscribeMethods; }
public PlayerModel(Game1 game, SkinnedModel skinnedModel) : base(game, skinnedModel) { game.mediator.register(this, MyEvent.P_RUN, MyEvent.C_ATTACK_BULLET_BEGIN); animationController.Speed = 1.2f; activeAnimation = PlayerAnimations.Idle; playAnimation(); }
void Start() { _input = GetComponent <PlayerInput>(); animations = GetComponentInChildren <PlayerAnimations>(); canMove = true; rb = GetComponent <Rigidbody2D>(); moveThreshold = 0.1f * _maxSpeed * Time.deltaTime; }
private void Start() { rb.velocity = new Vector2(0, baseBounceVelocity); gravityOn = true; gameManager.GetComponent <GameManager>().player = gameObject; gameManager.GetComponent <GameManager>().startBounceVelocity = baseBounceVelocity; anims = gameObject.GetComponent <PlayerAnimations>(); }
private void Awake() { pWorldInfo = GetComponent <PlayerWorldInfo>(); pAnim = GetComponent <PlayerAnimations> (); rb = GetComponent <Rigidbody2D> (); statistics = GetComponent <Stats>(); availableJumps = maxJumps; }
private void Awake() { movement = GetComponent <PlayerMovement>(); animations = GetComponent <PlayerAnimations>(); dash = GetComponent <PlayerDash>(); fire = GetComponent <PlayerFire>(); stats = GetComponent <PlayerStats>(); }
private void Awake() { platformer = GetComponent <Platformer2D>(); animations = GetComponent <PlayerAnimations>(); flashlight = GetComponent <FlashlightController>(); }
void Start() { energySystem = this.GetComponent <EnergySystem>(); actions = this.GetComponent <PlayerActions>(); animations = this.GetComponent <PlayerAnimations>(); spells = this.GetComponent <PlayerSpells>(); spellsSystem = this.GetComponent <SpellsSystem>(); }
protected override void OnDestroy(double currentTime) { this.alive = false; //this.PendingDestroy = true; Console.WriteLine("Destroy player "); this.spriteAnimation = PlayerAnimations.GetDeathAnimation(1); this.spriteAnimation.Start(currentTime); }
void Start() { _rigid = GetComponent <Rigidbody2D>(); _playerAnim = GetComponent <PlayerAnimations>(); _playerSprite = GetComponentInChildren <SpriteRenderer>(); _swordArcSprite = transform.GetChild(1).GetComponent <SpriteRenderer>(); Health = 4; }
private void Start() { playerMovement = GetComponent <PlayerMovement>(); playerAttack = GetComponent <PlayerAttack>(); playerAnimations = GetComponent <PlayerAnimations>(); rb = GetComponent <Rigidbody2D>(); audioSystem = GameObject.FindWithTag("AudioSystem").GetComponent <AudioSystem>(); }
public PlayerJumpingState(PlayerStateController playerController, StateMachine stateMachine) { this.playerController = playerController; this.stateMachine = stateMachine; movementController = playerController.movementController; animationController = playerController.animationController; animations = (PlayerAnimations)animationController.animationsList; }
// Use this for initialization void Start() { anima = GetComponent <PlayerAnimations>(); createBubble = GetComponent <PlayerCreateBubble>(); hp = PlayerData.instance.hpMax(); currentHp = hp; hpImg = transform.Find("bkg_hp").Find("hp").GetComponent <Image>(); }
public Field(Game game) { m_game = game; currentField = this; timerManager = new TimerManager(); players = new PlayerList(timerManager, CVars.cg_maxPlayers.intValue); m_tempCellsList = new LinkedList<FieldCell>(); m_tempMovableList = new List<MovableCell>(); movableCells = new LinkedList<MovableCell>(); m_playerAnimations = new PlayerAnimations(); m_bombAnimations = new BombAnimations(); }
public void SetAnimation(PlayerAnimations animation, bool reset, bool enableLoop, bool waitFinish) { // TEMP Changes - only one animation SetAnimation(0*(int)animation, reset, enableLoop, waitFinish); }
void Start() { animations=new PlayerAnimations(this); //last_aim_direction=last_move_direction=Vector3.forward; legit_timer = new Timer(888, OnLegit); onGround_timer= new Timer(200, OnGroundTimer); mp_regen_timer= new Timer(stats.MP_regen_delay, OnMPregenTimer); hp=stats.HP; mp=stats.MP; if (regen_multi==-1) mp=0; //Data set ability_containers = new List<AbilityContainer>(); for (int i=0; i<Data.Abilities.Count; i++){ var abb = new AbilityContainer(this,Data.Abilities[i]); ability_containers.Add(abb); } _Color=Data.color; controllerNumber=Data.controllerNumber; //NotificationCenter.Instance.addListener(OnExplosion,NotificationType.Explode); NotificationCenter.Instance.addListener(OnKnockback,NotificationType.HaxKnockback); }
private void Run() { if (running) { if (activeAnimation != PlayerAnimations.Run && !attacking) { activeAnimation = PlayerAnimations.Run; animationController.LoopEnabled = true; playAnimation(); } } else { if (activeAnimation != PlayerAnimations.Idle && !attacking) { activeAnimation = PlayerAnimations.Idle; animationController.LoopEnabled = true; playAnimation(); } } }
private void Attack() { if (attacking) { if (animationController.IsPlaying && activeAnimation != PlayerAnimations.Aim && activeAnimation != PlayerAnimations.Shoot) { activeAnimation = PlayerAnimations.Aim ; animationController.LoopEnabled = false; playAnimation(); } else if (!animationController.IsPlaying && activeAnimation == PlayerAnimations.Aim) { activeAnimation = PlayerAnimations.Shoot; animationController.LoopEnabled = false; playAnimation(); } else if(!animationController.IsPlaying && activeAnimation == PlayerAnimations.Shoot) { attacking = false; shooting = true; } } }
// Use this for initialization private void Start() { myCam = GameObject.Find("MainCamera_ortographic").camera; screen = myCam.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0)); zeroPosWorldPoint = myCam.ViewportToWorldPoint(new Vector3(0, 0, 0)); rightSidePosWorldPoint = myCam.ViewportToWorldPoint(new Vector3(1, 0, 0)); leftSidePosWorldPoint = myCam.ViewportToWorldPoint(new Vector3(0, 1, 0)); if (RootToDetectScreenEdge == null) Debug.Log("Error. Needs to assigne RootToDetectScreenEdge (used for screen detecting)"); if (OriginalToFollow == null) Debug.Log("Error. Needs to assigne OriginalToFollow to follow"); if (OnlyScreenWrapNoClone) { RootToDetectScreenEdgeTransform = gameObject.transform; OriginalToFollowTransform = gameObject.transform; } else { RootToDetectScreenEdgeTransform = RootToDetectScreenEdge.transform; OriginalToFollowTransform = OriginalToFollow.transform; } if (myCam == null) Debug.Log("Error. Needs to assigne main camera for screen wrapping!"); if (OnlyScreenWrapNoClone) return; if (Clone == null) Debug.Log("Error. Needs to assigne a clone for screen wrapping!" + gameObject); if (Clone.GetComponent<BoxCollider>() != null) cloneBoxCollider = Clone.GetComponent<BoxCollider>(); //else // Debug.Log("Has no trigger attached"); if (Clone.GetComponent<Rigidbody>() != null) cloneRigidbody = Clone.GetComponent<Rigidbody>(); //else // Debug.Log("Has no rigidbody attached"); if(Clone != null && UseAnimations) { cloneBody = Clone.transform.Find("Armature").gameObject; originalBodyRenderer = OriginalToFollow.GetComponent<Player>().BodyRenderer; originalHelmetRenderers = OriginalToFollow.GetComponent<Player>().HelmetRenderers; if(RendererObject.GetComponent<SkinnedMeshRenderer>() != null) cloneBodyRenderer = RendererObject.GetComponent<SkinnedMeshRenderer>(); if(RendererObject.GetComponentsInChildren<MeshRenderer>() != null) { cloneHelmetRenderers = RendererObject.GetComponentsInChildren<MeshRenderer>(); EnableRenderers(false); cloneActive = false; } } if(OriginalToFollow.GetComponent<PlayerAnimations>() != null) originalAnimations = OriginalToFollow.GetComponent<PlayerAnimations>(); if(GetComponent<Animator>() != null && UseAnimations == true) { anim = Clone.GetComponent<Animator>(); anim.speed = 1.5f; } }
private void Attack(GameTime gameTime) { if (attacking) { if (animationPlay && animationController.IsPlaying && activeAnimation != PlayerAnimations.Aim && activeAnimation != PlayerAnimations.Shoot) { activeAnimation = PlayerAnimations.Aim ; animationController.LoopEnabled = false; playAnimation(); } else if ((!animationController.IsPlaying && activeAnimation == PlayerAnimations.Aim )|| !animationPlay) { activeAnimation = PlayerAnimations.Shoot; animationController.LoopEnabled = false; playAnimation(); } else if(!animationController.IsPlaying && activeAnimation == PlayerAnimations.Shoot) { delay += (int)gameTime.ElapsedGameTime.TotalMilliseconds; if (delay > delayInterval) { delay -= delayInterval; shooting = true; num_of_attacks--; if (num_of_attacks == 0) attacking = false; } } } }