// Start is called before the first frame update void Start() { Animator = GetComponent <UnityEngine.Animator>(); rb = GetComponent <Rigidbody2D>(); sprite = GetComponent <SpriteRenderer>(); dash = GetComponent <DashAbility>(); }
void Start() { lookR = true; rb2d = GetComponent <Rigidbody2D>(); dashLogic = GetComponent <DashAbility>(); gunGameObject = gun.gameObject; shotgun = Resources.Load <Sprite>("Shotgun1") as Sprite; pistol = Resources.Load <Sprite>("Pistol1") as Sprite; railgun = Resources.Load <Sprite>("railgun") as Sprite; pistolAnim = Resources.Load <Animator>("PistolAnimator") as Animator; shotgunAnim = Resources.Load <Animator>("ShotgunAnimator") as Animator; spriteRenderer = gun.GetComponent <SpriteRenderer>(); guns = new string[3]; int level = GameManager.instance.GetComponent <LevelManagement>().GetLevel(); if (level < 4) { num_gun = 2; } else { num_gun = 3; } guns[0] = "Pistol1"; guns[1] = "Shotgun1"; guns[2] = "Railgun1"; GameManager.instance.CombatCounter = 0; }
private void Push(GameObject target) { Rigidbody body = GetComponent <Rigidbody>(); DashAbility dash = Player.GetAbility <DashAbility>(); Rigidbody otherBody = target.GetComponent <Rigidbody>(); Player otherPlayer = target.GetComponent <PlayerController>().Player; otherPlayer.State.On(Player.States.Pushed); G.Instance.Pipeline.New(). Func(() => { Vector3 force = otherBody.velocity.normalized * 0.5f * dash.Force; otherBody.AddForce(force, ForceMode.Impulse); }) .Delay(0.8f) .Func(() => { otherPlayer.State.Off(Player.States.Pushed); }); body.velocity = Vector3.zero; Player.State.Off(Player.States.Dashing); if (otherPlayer.HasOrb) { otherPlayer.DropOrb(otherBody.transform.position); } }
// Start is called before the first frame update void Start() { if (player == null) { player = GameObject.Find("Player"); } if (playerController == null) { playerController = player.GetComponent <PlayerController>(); } if (playerBehaviour == null) { playerBehaviour = player.GetComponent <PlayerBehaviour>(); } if (dashAbility == null) { dashAbility = player.GetComponent <DashAbility>(); } if (line == null) { line = GetComponent <LineRenderer>(); } StartCoroutine(UpdateDesiredLocation()); RegenDroneToggle(true); }
public static Ability GetAbility(CharacterClasses playerClass, GameObject go) { Ability ability = new DashAbility(go); switch (playerClass) { case CharacterClasses.Melee: ability = new DashAbility(go); break; case CharacterClasses.Bowman: ability = new InvisibilityAbility(go); break; case CharacterClasses.Magician: ability = new SiphonAoeBlood(go); break; case CharacterClasses.Dartblower: ability = new ImmolationAbility(go); break; default: break; } return(ability); }
// Start is called before the first frame update void Start() { body = GetComponent <Rigidbody2D>(); dash = GetComponent <DashAbility>(); anim = GetComponent <Animator>(); sprite = GetComponent <SpriteRenderer>(); }
// Start is called before the first frame update void Start() { inMiddleOfAttack = false; inMiddleOfJump = false; rb = GetComponent <Rigidbody>(); ks = Controls.GetKeyset(controls); if (rotationAxis.Equals(axis.x)) { rotationVector = Vector3.right; } else if (rotationAxis.Equals(axis.y)) { rotationVector = Vector3.up; } else if (rotationAxis.Equals(axis.z)) { rotationVector = Vector3.forward; } rb.mass = mass; //deltaRotation = Quaternion.Euler(rotationVector * angularVelocity * Time.deltaTime); /* No amount of angular velocity could generate enough force to keep the blade stable while spinning. * So used this to keep the blade stable. */ rb.freezeRotation = true; Physics.gravity = Vector3.down * jumpGravity; initRotation = transform.rotation; dashAbility = new DashAbility(); dashAbility.dashState = DashState.Ready; tilt = new Tilt(initRotation.eulerAngles.x, maxTilt); //Rotating the blade every frame to keep it spinning. bladeSpin = Quaternion.Euler(Vector3.forward * angularVelocity * Time.deltaTime); }
private void Initialize() { if (player.Player.IsInitialized) { hookAbility = player.Player.GetAbility <HookAbility>(); dashAbility = player.Player.GetAbility <DashAbility>(); } }
private void AddDashAbility() { DashAbility ability = new DashAbility(gameObject, player.transform); ability.onBegin += () => { agent.isStopped = true; }; ability.onComplete += () => { agent.isStopped = false; }; abilities.Add(new RangeCondition(transform, player.transform, 7.0f), ability); }
private void Awake() { characterController = GetComponentInParent <CharacterController>(); dashAbility = GetComponentInParent <DashAbility>(); feetSlot = GameObject.Find("EquipedItemFeet").GetComponent <SpriteRenderer>(); theCamera = GameObject.Find("Main Camera").GetComponent <Camera>(); defaultCameraZoom = theCamera.orthographicSize; }
public static DashAbility CreateDashAbility() { DashAbility asset = ScriptableObject.CreateInstance <DashAbility>(); AssetDatabase.CreateAsset(asset, GetSelectedPathOrFallback() + "/NewDashAbility.asset"); AssetDatabase.SaveAssets(); return(asset); }
void Start() { playerInput = GetComponent <PlayerInput>(); rigidbody = GetComponent <Rigidbody>(); dash = directionOfMovement.GetComponent <DashAbility>(); playerState = GetComponent <PlayerStates>(); animController = GetComponent <Animator>(); }
public void StartLevel(float time, int retryQuantity) { Dead = false; TimeStopAbility.Fill(); DashAbility.RestoreDash(); _maxHealth = time; stats.Health = time; healthDiplayer.SetUpMaxValue(time); RetryQuantity = retryQuantity; }
private void MakeSingleton() { if (instance != null) { Destroy(gameObject); } else { instance = this; } }
protected override void Start() { base.Start(); gameObject.tag = Defines.c_tagPlayer; m_jumpAbility = new JumpAbility(this, 2); m_climbWallAbility = new ClimbWallAbility(this); m_grabLedgeAbility = new GrabLedgeAbility(this); m_dashAbility = new DashAbility(this, 15, 0.4f, 1f); m_climbLadderAbility = new ClimbLadderAbility(this); }
private void Awake() { reflect = GetComponentInChildren <ReflectAbility>(); Assert.IsNotNull(reflect, "Reflect ability was not found."); dash = GetComponentInChildren <DashAbility>(); Assert.IsNotNull(dash, "Dash ability was not found."); projectile = GetComponentInChildren <ProjectileAbility>(); Assert.IsNotNull(projectile, "Projectile ability was not found."); chargeManager = GetComponent <ChargeManager>(); Assert.IsNotNull(chargeManager, "ChargeManager was not found."); }
void Start() { PlayerOne = GameObject.Find ("PlayerOne"); PlayerTwo = GameObject.Find ("PlayerTwo"); // Add Abilities Freeze = GetComponent<FreezeAbility>(); Dash = GetComponent<DashAbility>(); Block = GetComponent<BlockAbility>(); Bomb = GetComponent<BombAbility>(); Attack = GetComponent<AttackAbility>(); // Grant abilties GiveAllAbilities (); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player")) { dash = collision.transform.GetComponent <DashAbility>(); if (dash.DMG == false && invulsecs == false) //Gör att man tar damage när man inte dashar och inte har invul frames. - Daniel { SoundManagerScript.PlaySound("hit"); //spela ta skada ljud - Mikhael damage = collision.GetComponent <damageplayer>(); // om fienden kolliderar med spelaren så skapar scriptet en referens till scriptet med health - Gustav damage.health--; //här tar spelet bort health från spelaren - Gustav print(damage.health); invulsecs = true; StartCoroutine(invul()); // ser till att spelaren har möjlighet att undanfly fienden - Gustav } } if (collision.gameObject.CompareTag("Ground")) { body.constraints = RigidbodyConstraints2D.FreezeAll; // ser till att fienden inte faller igenom golvet trots att den är en trigger - Gustav } }
void Awake() { _controller = GetComponent <CharacterController2D>(); _dashAbility = GetComponent <DashAbility>(); _horizontalMoveAbility = GetComponent <HorizontalMoveAbility>(); // listen to some events for illustration purposes //_controller.onControllerCollidedEvent += onControllerCollider; //_controller.onTriggerEnterEvent += onTriggerEnterEvent; _controller.onTriggerExitEvent += onTriggerExitEvent; _controller.onTriggerStayEvent += onTriggerStayEvent; if (airBreakThreshold <= airBreakSpeed) { throw new Exception("Airbreak Threshold must be higher than airbreak speed"); } rb = GetComponent <Rigidbody2D>(); rb.sleepMode = RigidbodySleepMode2D.NeverSleep; }
void Start() { OnGroundCollisionEnter = delegate { }; OnGroundCollisionStay = delegate { }; disableSelf = true; if (health == 0) { health = 100; } extraJumps = extraJumpValue; rb = GetComponent <Rigidbody2D>(); audioSource = this.GetComponent <AudioSource>(); audioSource.clip = this.stepClip; audioSource.clip = this.jumpClip; DashAbility abil = GetComponent <DashAbility>(); if (abil != null) { OnGroundCollisionEnter += abil.PlayerIsGrounded; OnGroundCollisionStay += abil.PlayerIsGrounded; } }
void Start() { dashAbility = dashPrefab.GetComponent <DashAbility>(); }
private void Start() { #region Should be removed after creating game manager if (_instance == null) { _instance = gameObject; } else { Destroy(gameObject); } DontDestroyOnLoad(gameObject); #endregion if (PlayerPrefs.HasKey("Exp")) { Exp = PlayerPrefs.GetInt("Exp"); } if (PlayerPrefs.HasKey("Health")) { Health = PlayerPrefs.GetInt("Health"); if (Health <= 0) { Health = 2; } } Moving = GetComponent <Moving>(); DashAbility = GetComponent <DashAbility>(); StrikeAbility = GetComponent <StrikeAbility>(); InvulnerAbility = GetComponent <InvulnerAbility>(); MobKilled = new UnityEvent(); AmbientEvent.AddListener(PlayPopSound); ExpCollected.AddListener(CollectCoin); HealthChanged.AddListener(UpdateHealthData); GameUI = GameObject.FindGameObjectWithTag(nameof(GameUI)) .GetComponent <GameUI>(); GameUI.ExpText.text = $"Опыт: {Exp} поинтов"; GameUI.HealthText.text = $"Здоровье: {Health}"; // Extract to level configuration var level = SceneManager.GetActiveScene().name; if (level == "FirstLevel") { GetComponent <DashAbility>().IsEnabled = false; GetComponent <StrikeAbility>().IsEnabled = false; GameUI?.DisableDash(); GameUI?.DisableStrike(); } if (level.Contains("Second") || level.Contains("Third") || level.Contains("Fourth")) { GetComponent <StrikeAbility>().IsEnabled = false; GameUI?.DisableStrike(); } if (GameObject.FindGameObjectWithTag("AchievPool") == null) { Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/AchievmentPool")); } Respawn(); }
protected override void Awake() { base.Awake(); dashAbility = GetComponent <DashAbility>(); }