Inheritance: MonoBehaviour
コード例 #1
0
ファイル: EnemyShield.cs プロジェクト: ButterKane/Robot-emUp
 public override void OnHit(BallBehaviour _ball, Vector3 _impactVector, PawnController _thrower, float _damages, DamageSource _source, Vector3 _bumpModificators = default)
 {
     if (_source == DamageSource.Dunk)
     {
         isShieldActivated_accesss = false; // It is bumped, so it will reactivate at the end of it
     }
     else if (_source == DamageSource.Ball)
     {
         if (!isShieldActivated || Vector3.Angle(_ball.GetCurrentDirection(), -transform.forward) > angleRangeForRebound)
         {
             print(Vector3.Angle(_ball.GetCurrentDirection(), -transform.forward));
             if (isShieldActivated)
             {
                 if (currentShieldDeactiveCoroutine != null)
                 {
                     StopCoroutine(currentShieldDeactiveCoroutine);
                     currentShieldDeactiveCoroutine = null;
                 }
                 currentShieldDeactiveCoroutine = DeactivateShieldForGivenTime(timeShieldDisappearAfterHit);
                 StartCoroutine(currentShieldDeactiveCoroutine);
             }
             base.OnHit(_ball, _impactVector, _thrower, _damages, _source, _bumpModificators);
         }
         else if (isShieldActivated && Vector3.Angle(_ball.GetCurrentDirection(), -transform.forward) < angleRangeForRebound)
         {
             _ball.Bounce(Vector3.Reflect(_ball.GetCurrentDirection(), transform.forward), 1);
         }
     }
 }
コード例 #2
0
    // Use this for initialization
    void Awake()
    {
        myController = GetComponent<PawnController> ();
        if (myController != null) {

        }
    }
コード例 #3
0
    void IHitable.OnHit(BallBehaviour _ball, Vector3 _impactVector, PawnController _thrower, float _damages, DamageSource _source, Vector3 _bumpModificators)
    {
        Analytics.CustomEvent("PlayerDamage", new Dictionary <string, object> {
            { "Source", _source }
        });
        Vector3 i_normalizedImpactVector = new Vector3(_impactVector.x, 0, _impactVector.z);

        switch (_source)
        {
        case DamageSource.RedBarrelExplosion:
            BumpMe(i_normalizedImpactVector, BumpForce.Force2);
            Damage(_damages);
            break;

        case DamageSource.EnemyContact:
            Damage(_damages);
            Push(PushType.Light, _impactVector, PushForce.Force1);
            break;

        case DamageSource.Laser:
            Damage(_damages, false);
            break;

        case DamageSource.SpawnImpact:
            Damage(_damages);
            Push(PushType.Light, _impactVector, PushForce.Force1);
            break;
        }
    }
コード例 #4
0
ファイル: BossBullet.cs プロジェクト: ButterKane/Robot-emUp
 public void OnHit(BallBehaviour _ball, Vector3 _impactVector, PawnController _thrower, float _damages, DamageSource _source, Vector3 _bumpModificators = default)
 {
     if (bossDatas.bulletStormSettings.hitableBullet)
     {
         Destroy(gameObject);
     }
 }
コード例 #5
0
 public IEnumerator MoveLeg_C()
 {
     isGrounded = false;
     for (float i = 0; i < 1; i += Time.deltaTime * (legSpeed * Random.Range(0.8f, 1.2f)))
     {
         if (wantedTransform != null && IK.Target != null && IK.Target.transform != null)
         {
             Vector3 newPosition = Vector3.Lerp(IK.Target.transform.position, wantedTransform.transform.position + forwardOffset, i / 1f);
             float   yPos        = Mathf.Lerp(IK.Target.transform.position.y, wantedTransform.transform.position.y, i / 1f);
             yPos         += heightCurve.Evaluate(i / 1f) * height;
             newPosition.y = yPos;
             IK.Target.transform.position = newPosition;
             yield return(null);
         }
     }
     IK.Target.transform.position = wantedTransform.transform.position + forwardOffset;
     isGrounded = true;
     if (eventOnStep != "")
     {
         FeedbackManager.SendFeedback(eventOnStep, this);
     }
     if (bumpPawnsOnGrounded)
     {
         List <PawnController> hitPawns = new List <PawnController>();
         foreach (Collider c in Physics.OverlapSphere(IK.Target.transform.position, bumpPawnRadius))
         {
             PawnController pawnController = c.GetComponentInParent <PawnController>();
             if (pawnController != null && !hitPawns.Contains(pawnController))
             {
                 pawnController.Push(PushType.Light, pawnController.transform.position - IK.Target.transform.position, PushForce.Force1);
                 hitPawns.Add(pawnController);
             }
         }
     }
 }
コード例 #6
0
    public void StartBoss()
    {
        Health1Bar_CurrentValue = Health1Bar_Value_Max;
        Health2Bar_CurrentValue = Health2Bar_Value_Max;
        healthBar1 = Instantiate(healthBarPrefab, GameManager.mainCanvas.transform).GetComponent <HealthBar>();
        healthBar1.customHealthBar = true;
        healthBar1.target          = this;

        healthBar2 = Instantiate(healthBarPrefab, GameManager.mainCanvas.transform).GetComponent <HealthBar>();
        healthBar2.customHealthBar     = true;
        healthBar2.customDeltaPosition = -1;
        healthBar2.target = this;

        healthBar1.ToggleHealthBar(true);
        healthBar2.ToggleHealthBar(true);
        isPhase1 = true;

        playerOneTransform      = GameManager.playerOne.transform;
        playerTwoTransform      = GameManager.playerTwo.transform;
        playerOnePawnController = playerOneTransform.GetComponent <PlayerController>();
        playerTwoPawnController = playerTwoTransform.GetComponent <PlayerController>();

        NumberHammerLeft = NumberHammerAttackMax;
        BossActivated    = true;
    }
コード例 #7
0
ファイル: PuzzleStop.cs プロジェクト: ButterKane/Robot-emUp
    public void OnHit(BallBehaviour _ball, Vector3 _impactVector, PawnController _thrower, float _damages, DamageSource _source, Vector3 _bumpModificators = default(Vector3))
    {
        //Stop the ball
        if (_ball != null)
        {
            Analytics.CustomEvent("BallStopped", new Dictionary <string, object> {
                { "Zone", GameManager.GetCurrentZoneName() },
            });
            _ball.ChangeSpeed(0);
            fX_StopBall = FeedbackManager.SendFeedback("event.PuzzleBlockBall", this, _ball.transform.position, -_impactVector, _impactVector).GetVFX();
        }

        //Show an FX
        if (fX_StopBall != null)
        {
            Destroy(fX_StopBall);
        }

        //Will desactivate all puzzle links
        PuzzleLink[] i_links = FindObjectsOfType <PuzzleLink>();
        foreach (var item in i_links)
        {
            item.chargingTime = -1f;
        }
    }
コード例 #8
0
 public void OnHit(BallBehaviour _ball, Vector3 _impactVector, PawnController _thrower, float _damages, DamageSource _source, Vector3 _bumpModificators = default)
 {
     if (_source == DamageSource.Dunk || _source == DamageSource.RedBarrelExplosion)
     {
         Destroy(gameObject);
     }
 }
コード例 #9
0
 public void OnHit(BallBehaviour _ball, Vector3 _impactVector, PawnController _thrower, float _damages, DamageSource _source, Vector3 _bumpModificators = default)
 {
     if (_source == DamageSource.Dunk)
     {
         hitByDunk = true;
     }
 }
コード例 #10
0
    private void Hit(int bases)
    {
        // remove strikes, fouls
        Strikes = 0;
        //Fouls = 0;

        // for each runner, advance a base
        for (int i = 0; i < Runners.Count; i++)
        {
            // advance runner
            GameObject     runner     = Runners[i];
            PawnController controller = runner.GetComponent <PawnController>();
            controller.Run();
        }

        // if runners should be advancing more than one base, loop back after time
        if (bases > 1)
        {
            StartCoroutine(HitLooper(2.5f, bases - 1));
        }
        else
        {
            ReturnToBatter();
        }
    }
コード例 #11
0
 public void OnHit(BallBehaviour _ball, Vector3 _impactVector, PawnController _thrower, float _damages, DamageSource _source, Vector3 _bumpModificators = default)
 {
     if (_source == DamageSource.Ball)
     {
         EnergyManager.IncreaseEnergy(BossSettings.GetDatas().staggerSettings.energyGainedOnHit);
     }
 }
コード例 #12
0
ファイル: BossLeg.cs プロジェクト: ButterKane/Robot-emUp
 public void OnHit(BallBehaviour _ball, Vector3 _impactVector, PawnController _thrower, float _damages, DamageSource _source, Vector3 _bumpModificators = default)
 {
     if (destroyed)
     {
         return;
     }
     FeedbackManager.SendFeedback("event.BossLegHit", this);
     legAnimator.StartCoroutine(legAnimator.BumpLeg_C());
     if (_source == DamageSource.PerfectReceptionExplosion)
     {
         _damages = _damages * perfectReceptionDamageMultiplier;
     }
     if (destroyable)
     {
         currentHP -= _damages;
         currentHP  = Mathf.Clamp(currentHP, 0f, maxHP);
         if (currentHP <= 0)
         {
             Dismantle();
         }
     }
     else
     {
         boss.Damage(_damages);
     }
 }
コード例 #13
0
 private void InitializePlayersRefs()
 {
     playerOneTransform      = GameManager.playerOne.transform;
     playerTwoTransform      = GameManager.playerTwo.transform;
     playerOnePawnController = playerOneTransform.GetComponent <PlayerController>();
     playerTwoPawnController = playerTwoTransform.GetComponent <PlayerController>();
 }
コード例 #14
0
 private void Awake()
 {
     linkedPawn         = GetComponent <PawnController>();
     playerUI           = GetComponent <PlayerUI>();
     maxStackAmount     = defaultMaxStackAmount;
     currentStackAmount = maxStackAmount;
 }
コード例 #15
0
    private void OnTriggerExit(Collider _other)
    {
        PawnController foundPawn = _other.gameObject.GetComponent <PawnController>();

        if (foundPawn)
        {
            if (pawnHereList.Contains(foundPawn))
            {
                pawnHereList.Remove(foundPawn);
                if (pawnHereList.Count < 1)
                {
                    if (isActivated)
                    {
                        FeedbackManager.SendFeedback("event.PuzzlePressurePlateDesactivation", this);
                    }
                    isActivated = false;
                    animator.SetBool("Activated", false);

                    DesactiveLinkedObjects();
                    pawnHere             = false;
                    transform.localScale = new Vector3(transform.localScale.x, 1f, transform.localScale.z);
                }
            }
        }

        //UpdateLight();
    }
コード例 #16
0
    public virtual void AddPawn(PawnController InPawn, bool bInDoRearrange = false)
    {
        if (InPawn != null)
        {
            if (Pawns.Count == 1)
            {
                if (GetPawn().GetColor() != InPawn.GetColor())
                {
                    PawnController tempPawn = GetPawn();
                    RemovePawn(tempPawn);
                    Band.AddPawn(tempPawn, true);
                }
            }

            Pawns.Add(InPawn);

            InPawn.SetParent(this);
            InPawn.SetOrder(Pawns.Count + 10);
            InPawn.SetGameManager(GameManager);

            if (bInDoRearrange)
            {
                Rearrange();
            }
        }
        else
        {
            // error
        }
    }
コード例 #17
0
    void FixedUpdate()
    {
        for (int i = 0; i < pawnTrapped.Count; i++)
        {
            PawnController item = pawnTrapped[i];
            if (item.GetHealth() < 1)
            {
                pawnTrapped.Remove(item);
            }
        }
        waitTimeBeforeNextDamage -= Time.deltaTime;

        if (waitTimeBeforeNextDamage < 0 && !isActivated && !shutDown)
        {
            waitTimeBeforeNextDamage = puzzleData.timeCheckingDamageEletricPlate;
            foreach (PawnController item in pawnTrapped)
            {
                if (item.GetComponent <EnemyBehaviour>())
                {
                    item.Damage(puzzleData.DamageEletricPlateEnnemies);
                }
                else
                {
                    item.Damage(puzzleData.DamageEletricPlate);
                }
                Analytics.CustomEvent("ElectricalPlateDamage", new Dictionary <string, object> {
                    { "Zone", GameManager.GetCurrentZoneName() },
                });
                item.AddSpeedModifier(new SpeedCoef(speedModifier, puzzleData.timeCheckingDamageEletricPlate, SpeedMultiplierReason.Freeze, false));

                FeedbackManager.SendFeedback("event.PuzzleElectricPlateDamage", item);
            }
        }
    }
コード例 #18
0
 public virtual void OnHit(BallBehaviour _ball, Vector3 _impactVector, PawnController _thrower, float _damages, DamageSource _source, Vector3 _bumpModificators = default)
 {
     if (!broken)
     {
         Break();
     }
 }
コード例 #19
0
 /// <summary>
 /// Determines whether this instance can apply effects on the specified player.
 /// </summary>
 /// <returns><c>true</c> if this instance can apply effects the specified p; otherwise, <c>false</c>.</returns>
 /// <param name="p">P.</param>
 public bool CanApplyEffectsToSelf(PawnController p)
 {
     if (this.GetItemClass() == "Potion")
     {
         if (this.GetItemSubClass() == "HealPotion")
         {
             if (p.remainingHealth < p.totalHealth)
             {
                 return(true);
             }
         }
         else if (this.GetItemSubClass() == "ManaPotion")
         {
             if (p.remainingEnergy < p.totalEnergy)
             {
                 return(true);
             }
         }
     }
     else if (this.GetItemClass() == "Magic")
     {
         if (this.GetItemSubClass() == "HealMagic")
         {
             if (p.remainingHealth < p.totalHealth)
             {
                 return(true);
             }
         }
         else if (this.GetItemSubClass() == "AttackMagic")
         {
             return(false);
         }
     }
     return(false);
 }
コード例 #20
0
 /// <summary>
 /// Applies the effect.
 /// </summary>
 /// <returns><c>true</c>, if effect was applied, <c>false</c> otherwise.</returns>
 /// <param name="p">P.</param>
 public bool ApplyEffect(PawnController p)
 {
     if (this.GetItemClass() == "Potion")
     {
         if (this.GetItemSubClass() == "HealPotion")
         {
             if (p.remainingHealth < p.totalHealth)
             {
                 p.GiveHealthAmount(this.GetHealEffect());
                 this.used = true;
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else if (this.GetItemSubClass() == "ManaPotion")
         {
             if (p.remainingEnergy < p.totalEnergy)
             {
                 p.GiveEnergyAmount(this.GetManaMod());
                 this.used = true;
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         // end potions
     }
     else if (this.GetItemClass() == "Magic")
     {
         if (p.CanUseEnergy(10))
         {
             if (this.GetItemSubClass() == "HealMagic")
             {
                 p.GiveHealthPercent((this.GetHealEffect() / 100f));
             }
             else if (this.GetItemSubClass() == "AttackMagic")
             {
                 // apply damage to player
                 p.SetDamage(this.GetAtkMod(), false);
             }
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         Debug.Log("Unable to Apply Effect of " + this.itemName);
         return(false);
     }
     return(false);
 }
コード例 #21
0
 private void Awake()
 {
     rb                   = GetComponent <Rigidbody2D>();
     pawnController       = GetComponent <PawnController>();
     animator             = MainTexture.GetComponent <Animator>();
     mainSpriteRenderer   = MainTexture.GetComponent <SpriteRenderer>();
     dissolveEffectHelper = MainTexture.GetComponent <DissolveEffectHelper>();
 }
コード例 #22
0
 private void OnTriggerEnter(Collider _other)
 {
     if (_other.GetComponent <PawnController>())
     {
         PawnController pawn = _other.gameObject.GetComponent <PawnController>();
         listPawnsHere.Add(pawn);
     }
 }
コード例 #23
0
 private void OnTriggerExit(Collider _other)
 {
     if (_other.gameObject.GetComponent <PawnController>())
     {
         PawnController _pawn = _other.gameObject.GetComponent <PawnController>();
         pawnTrapped.Remove(_pawn);
     }
 }
コード例 #24
0
 private void Start()
 {
     linkedPawn = GetComponent <PawnController>();
     animator   = linkedPawn.animator;
     GeneratePreviewDecal();
     GenerateGrabHand();
     TogglePreview(false);
 }
コード例 #25
0
 private void OnTriggerExit(Collider _other)
 {
     if (canDamagePlayer && _other.GetComponent <PawnController>())
     {
         PawnController pawn = _other.gameObject.GetComponent <PawnController>();
         listPawnsHere.Remove(pawn);
     }
 }
コード例 #26
0
 /// <summary>
 /// called after AI sequence has finished.
 /// </summary>
 /// <param name="attacked">Attacked.</param>
 /// <param name="requiredCooldownLength">Cooldown length needed for animation.</param>
 public void OnEnemyActionUsed(PawnController attacked, float requiredCooldownLength)
 {
     if (combatController.currentState == CombatController.BattleStates.ENEMYCHOICE)
     {
         enemyHasAttacked = true;
         StartCooldown(requiredCooldownLength);
         combatController.setState(CombatController.BattleStates.ENEMYANIMATE);
     }
 }
コード例 #27
0
    /// <summary>
    /// Checks if given pawn can be moved by current player in current state of the game.
    /// </summary>
    /// <param name="InPawn">The pawn that we want to know if can be moved or not.</param>
    /// <returns>Whether given pawn can be moved or not.</returns>
    public bool CanPawnBeMoved(PawnController InPawn)
    {
        if (InPawn != null && CurrentPlayer == InPawn.GetColor())
        {
            return(InPawn.GetColor() == PlayerColor.Red ? State == GameState.RedPlayerMoves : State == GameState.WhitePlayerMoves);
        }

        return(false);
    }
コード例 #28
0
ファイル: PlayerController.cs プロジェクト: Lagunovas/ludo
    private void Update()
    {
        if (isClient)
        {
            if (hasAuthority)
            {
                if (slot == GameController.Instance.currentTurn)
                {
                    if (Input.GetKeyDown(KeyCode.R))
                    {
                        CmdSkipTurn();
                    }

                    if (!pawnSelected && rolledAmount > 0)
                    {
                        if (Input.GetMouseButtonDown(0))
                        {
                            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

                            RaycastHit[] hits = Physics.RaycastAll(ray);

                            foreach (RaycastHit hit in hits)
                            {
                                GameObject go = hit.collider.gameObject;
                                if (go.tag == "Pawn")
                                {
                                    Transform gopt = go.transform.parent;
                                    if (gopt.childCount == 2)
                                    {
                                        PawnController pawnController = gopt.gameObject.GetComponent <PawnController>();
                                        if (pawnController.playerController)                                           // wont be initialised for players who joined after, no issue
                                        {
                                            if (slot != -1 && slot == pawnController.playerController.slot)
                                            {
                                                if (pawnController.IsSelectable())
                                                {
                                                    CmdOnSelectPawn(gopt.GetComponent <NetworkIdentity>().netId);
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        else             // server
                         //foreach (PawnController pawn in pawns) {
                         //	pawn.SetCanSelect(!pawnSelected);
                         //}
        {
        }
    }
コード例 #29
0
 void ChangingFocus(Transform _newFocus)
 {
     if (_newFocus != null)
     {
         focusedPawnController = _newFocus.GetComponent <PawnController>();
     }
     else
     {
         focusedPawnController = null;
     }
 }
コード例 #30
0
 private void Start()
 {
     if (firstPawn == null)
     {
         firstPawn = GameManager.playerOne;
     }
     if (secondPawn == null)
     {
         secondPawn = GameManager.playerTwo;
     }
 }
コード例 #31
0
 public virtual void RemovePawn(PawnController InPawn)
 {
     if (InPawn != null)
     {
         int index = Pawns.IndexOf(InPawn);
         if (IsValidPawnIndex(index))
         {
             Pawns.RemoveAt(index);
         }
     }
 }
コード例 #32
0
 private void Awake()
 {
     pawnController = GetComponent<PawnController>();
 }
コード例 #33
0
ファイル: Pawn.cs プロジェクト: clotha87762/yu_da_carry
 public void setPawnController(PawnController PC)
 {
     this.PC = PC;
 }
コード例 #34
0
ファイル: BaseController.cs プロジェクト: halbich/TimeLapsus
    // Use this for initialization
    private void Start()
    {
        Fader = GetComponentInChildren<SceneFadeInOut>();
        CursorManager = GetComponent<CursorManager>();

        PlayerController = PlayerCharacter.GetComponent<PawnController>();
        DescriptionController = FindObjectOfType<DescriptionController>();
        dialogueBlocker = FindObjectOfType<DialogueBlockerController>();
        HidingController = FindObjectOfType<HidingController>();
        ControlsScreenController = FindObjectOfType<ControlsScreenController>();

        if (PlayerController == null)
        {
            Debug.LogError("No controller");
            return;
        }

        var enterData = GetEnterData(PreviousLoadedLevel);
        PlayerController.SetInitPosition(enterData.StartPoint);
        PlayerController.SetNewFacing(enterData.Direction);
    }