Ejemplo n.º 1
0
    public static void Walk(ClassHero classHero, Vector2 directions)
    {
        BehaviourPhysics.Move(classHero.gameObject, directions, classHero.speed);

        BehaviourAnimation.Flip(classHero.gameObject, directions);
        BehaviourAnimation.Play(classHero.gameObject, "Walk");
    }
Ejemplo n.º 2
0
    public static void PressDown(ClassKey classKey, string key)
    {
        BehaviourAnimation.Play(classKey.gameObject, key);

        switch (key)
        {
        case "Right":
            MoveShield(classKey, new Vector2(60, 0));
            break;

        case "Left":
            MoveShield(classKey, new Vector2(-60, 0));
            break;

        case "Up":
            MoveShield(classKey, new Vector2(0, 60));
            break;

        case "Down":
            MoveShield(classKey, new Vector2(0, -60));
            break;

        case "Idle":
            MoveShield(classKey, new Vector2(1000, 1000));
            break;
        }
    }
Ejemplo n.º 3
0
    private void Blink()
    {
        BehaviourAnimation.Play(gameObject, "Blink");

        float n = Random.Range(5f, 15f);

        Invoke("Blink", n);
    }
Ejemplo n.º 4
0
 public void Turn()
 {
     if (gameObject.transform.eulerAngles.z == 0)
     {
         BehaviourAnimation.Play(gameObject, "TurnDown");
     }
     else
     {
         BehaviourAnimation.Play(gameObject, "TurnUp");
     }
 }
Ejemplo n.º 5
0
    public static void Hurt(ClassEarth classEarth)
    {
        GameObject camera = GameObject.Find("Game Camera/Effect");

        BehaviourAnimation.Play(classEarth.gameObject, "Hurt");
        BehaviourAnimation.Play(camera, "Hurt");

        BehaviourSound.Play("SFX/Explosion");

        Camera.main.GetComponent <Shaker>().Shake(40f, 1);
    }
Ejemplo n.º 6
0
    public void CollisionBlock(string block)
    {
        int lie;

        switch (block)
        {
        case "Block_Up":
            if (directionArrows == "Up")
            {
                directionArrows = "Down";
                arrows.BroadcastMessage("Turn");
                MoveArrows(-1);

                lie = Random.Range(0, 2);
                if (lie == 0)
                {
                    BehaviourAnimation.Play(blockUp, "Truth");
                    BehaviourAnimation.Play(blockDown, "Truth");
                    MoveBlocks(-1);
                }
                else
                {
                    BehaviourAnimation.Play(blockUp, "Lie");
                    BehaviourAnimation.Play(blockDown, "Lie");
                    MoveBlocks(1);
                }
            }
            break;

        case "Block_Down":
            if (directionArrows == "Down")
            {
                directionArrows = "Up";
                arrows.BroadcastMessage("Turn");
                MoveArrows(1);

                lie = Random.Range(0, 2);
                if (lie == 0)
                {
                    BehaviourAnimation.Play(blockUp, "Truth");
                    BehaviourAnimation.Play(blockDown, "Truth");
                    MoveBlocks(1);
                }
                else
                {
                    BehaviourAnimation.Play(blockUp, "Lie");
                    BehaviourAnimation.Play(blockDown, "Lie");
                    MoveBlocks(-1);
                }
            }
            break;
        }
    }
Ejemplo n.º 7
0
    public static void Attack(ClassHero classHero)
    {
        //BehaviourPhysics.Force(classHero.gameObject, Vector2.right * classHero.faceRight, classHero.forceAttack);
        BehaviourPhysics.Move(classHero.gameObject, Vector2.right * classHero.faceRight, classHero.forceAttack);

        BehaviourAnimation.Play(classHero.gameObject, "Attack");

        if (!classHero.isAttack)
        {
            AudioClip audio = classHero.sfx[2];
            BehaviourSound.Play(classHero.gameObject, audio);
        }
    }
Ejemplo n.º 8
0
    public static void Damage(ClassHero classHero)
    {
        classHero.life         -= 10;
        classHero.hp.fillAmount = classHero.life / 100;
        if (classHero.life <= 0)
        {
            GameObject.Find("GameManager").GetComponent <GameScript>().GameOver();
        }

        GameObject.Find("GameManager").GetComponent <ManagerCamera>().DamageEffect();

        BehaviourAnimation.Play(classHero.gameObject, "Damage");

        AudioClip audio = classHero.sfx[1];

        BehaviourSound.Play(classHero.gameObject, audio);
    }
Ejemplo n.º 9
0
        public void NextBehaviorModeRule(bool _update = false)
        {
            if (!ActiveBehaviourIsValid)
            {
                PrintDebugLog(this, "NextBehaviorModeRule : invalid Behaviour '" + ActiveBehaviourModeKey + "', please check this mode and its rules!");
            }
            else
            {
                // NextRule will be false if there are no rules but also no new rule, the first
                // case should never be true so we can use _forced to run a simulated rule change
                // to refresh the parameter and/or start animation and audio files, effects and events
                // etc.
                if (m_ActiveBehaviourMode.NextRule() || _update)
                {
                    if (m_ActiveBehaviourMode.LastRule != null)
                    {
                        BehaviourAnimation.Stop(m_ActiveBehaviourMode.Rule.Animation);
                        m_ActiveBehaviourMode.LastRule.Stop();
                    }

                    if (m_ActiveBehaviourMode.Rule != null)
                    {
                        if (DebugLogIsEnabled)
                        {
                            PrintDebugLog(this, "NextBehaviorModeRule : Start rule #" + m_ActiveBehaviourMode.Rule.Index + " of Behaviour Mode " + ActiveBehaviourModeKey + "!");
                        }

                        m_ActiveBehaviourMode.Rule.Start(OwnerComponent);

                        BehaviourAnimation.Play(m_ActiveBehaviourMode.Rule.Animation);
                        BehaviourAudioPlayer.Play(m_ActiveBehaviourMode.Rule.Audio);
                        BehaviourLook.Adapt(m_ActiveBehaviourMode.Rule.Look);
                        //BehaviourMessage.Send( m_ActiveBehaviourMode.Rule.Message );
                    }

                    m_BehaviourModeRuleLength = m_ActiveBehaviourMode.RuleLength();
                    m_BehaviourModeRuleTimer  = 0;

                    m_BehaviourModeRuleChanged = m_ActiveBehaviourMode.RuleChanged;
                    if (OnBehaviourModeRuleChanged != null && m_BehaviourModeRuleChanged == true)
                    {
                        OnBehaviourModeRuleChanged(Owner, m_ActiveBehaviourMode.Rule, m_ActiveBehaviourMode.LastRule);
                    }
                }
            }
        }
Ejemplo n.º 10
0
        public void NextBehaviorModeRule(bool _forced = false)
        {
            if (m_ActiveBehaviourMode == null)
            {
                if (m_BehaviourModeValid)
                {
                    Debug.LogWarning("CAUTION : INVALID BEHAVIOURMODE '" + BehaviourModeKey + "' AT CREATURE '" + m_Owner.gameObject.name.ToUpper() + "'!");
                }

                m_BehaviourModeValid = false;

                return;
            }
            else
            {
                m_BehaviourModeValid = true;
            }


            if (m_ActiveBehaviourMode.NextRule() || _forced)
            {
                BehaviourAnimation.Play(m_ActiveBehaviourMode.Rule);
                BehaviourAudio.Play(m_ActiveBehaviourMode.Rule.Audio);

                if (m_ActiveBehaviourMode.LastRule != null)
                {
                    m_ActiveBehaviourMode.LastRule.StopEffect();
                }

                if (m_ActiveBehaviourMode.Rule != null)
                {
                    m_ActiveBehaviourMode.Rule.StartEffect(m_Owner);
                }

                m_BehaviourModeRuleLength = m_ActiveBehaviourMode.RuleLength();
                m_BehaviourModeRuleTimer  = 0;

                m_BehaviourModeRuleChanged = m_ActiveBehaviourMode.RuleChanged;
            }
        }
Ejemplo n.º 11
0
    public static void Idle(ClassHero classHero)
    {
        BehaviourPhysics.Move(classHero.gameObject, Vector2.right, 0);

        BehaviourAnimation.Play(classHero.gameObject, "Idle");
    }
Ejemplo n.º 12
0
 public static void ChangeColor(ClassTrashCan dataTrashCan, string color)
 {
     BehaviourAnimation.Play(dataTrashCan.gameObject, "Color_" + color);
 }
Ejemplo n.º 13
0
 private void EndLoadScreen()
 {
     BehaviourAnimation.Play(curtain, "Open");
 }
Ejemplo n.º 14
0
 public void StartLoadScreen(string scene)
 {
     BehaviourAnimation.Play(curtain, "Close");
     StartCoroutine(LoadScene(scene));
 }