コード例 #1
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;
        }
    }
コード例 #2
0
        public bool LateUpdate(StatusObject _status)
        {
            if (_status == null || ActiveBehaviourMode == null || ActiveBehaviourModeRule == null)
            {
                return(false);
            }

            m_ActiveBehaviourMode.Update();

            if (m_BehaviourModeRuleTimer >= m_BehaviourModeRuleLength)
            {
                if (m_ActiveBehaviourMode.Rule != null && m_ActiveBehaviourMode.Rule.HasModeLink)
                {
                    SetBehaviourModeByKey(ActiveBehaviourMode.Rule.Link.BehaviourModeKey);
                }
                else if (ActiveBehaviourMode.ValidRules.Count > 1)
                {
                    NextBehaviorModeRule();
                }
            }

            BehaviourAnimation.Update(ActiveBehaviourModeRule.Animation);

            ActiveBehaviourModeRule.Inventory.Update(_status.Inventory);

            return(true);
        }
コード例 #3
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");
    }
コード例 #4
0
ファイル: ClassEarth.cs プロジェクト: Hosomy17/STW
    private void Blink()
    {
        BehaviourAnimation.Play(gameObject, "Blink");

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

        Invoke("Blink", n);
    }
コード例 #5
0
        public void Init(GameObject gameObject)
        {
            m_Owner = gameObject;
            BehaviourAnimation.Init(m_Owner);

            for (int i = 0; i < BehaviourModes.Count; i++)
            {
                m_BehaviourModesKeys.Add(BehaviourModes[i].Key, i);
            }
        }
コード例 #6
0
ファイル: ClassEarth.cs プロジェクト: Hosomy17/STW
    void OnCollisionEnter2D(Collision2D c)
    {
        if (c.gameObject.CompareTag("Iten"))
        {
            trashCan.controllerTrashCan.Hurt();
            controllerEarth.Hurt();

            BehaviourAnimation.Float(gameObject, "Life", trashCan.life);
        }
    }
コード例 #7
0
ファイル: FacadeEarth.cs プロジェクト: Hosomy17/STW
    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);
    }
コード例 #8
0
        public override void Init(ICEWorldBehaviour _component)
        {
            base.Init(_component);

            BehaviourAnimation.Init(_component);

            for (int i = 0; i < BehaviourModes.Count; i++)
            {
                m_BehaviourModesKeys.Add(BehaviourModes[i].Key, i);
            }
        }
コード例 #9
0
ファイル: ClassArrow.cs プロジェクト: Hosomy17/kokoro
 public void Turn()
 {
     if (gameObject.transform.eulerAngles.z == 0)
     {
         BehaviourAnimation.Play(gameObject, "TurnDown");
     }
     else
     {
         BehaviourAnimation.Play(gameObject, "TurnUp");
     }
 }
コード例 #10
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;
        }
    }
コード例 #11
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);
        }
    }
コード例 #12
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);
    }
コード例 #13
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);
                    }
                }
            }
        }
コード例 #14
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;
            }
        }
コード例 #15
0
        //--------------------------------------------------
        // Update
        //--------------------------------------------------
        public void UpdateBegin()
        {
            m_BehaviourModeChanged      = false;
            m_BehaviourModeRulesChanged = false;
            m_BehaviourModeRuleChanged  = false;

            m_BehaviourTimer         += Time.deltaTime;
            m_BehaviourModeRuleTimer += Time.deltaTime;

            if (m_BehaviourModeRuleLength > 0 && m_BehaviourModeRuleTimer >= m_BehaviourModeRuleLength)
            {
                if (ActiveBehaviourModeRuleHasModeLink)
                {
                    SetBehaviourModeByKey(m_ActiveBehaviourMode.Rule.Links.BehaviourModeKey);
                }
                else
                {
                    NextBehaviorModeRule();
                }
            }

            BehaviourAnimation.Update();
        }
コード例 #16
0
    public static void Idle(ClassHero classHero)
    {
        BehaviourPhysics.Move(classHero.gameObject, Vector2.right, 0);

        BehaviourAnimation.Play(classHero.gameObject, "Idle");
    }
コード例 #17
0
        /// <summary>
        /// Sets the behaviour mode by key.
        /// </summary>
        ///<description>Use this function to change the behaviour of your creature.</description>
        /// <param name="key">Key.</param>
        public bool SetBehaviourModeByKey(string _key)
        {
            bool _behaviour_mode_changed = false;

            if (string.IsNullOrEmpty(_key))
            {
                if (m_BehaviourModeKeyIsValid)
                {
                    PrintDebugLog(this, "SetBehaviourModeByKey : Invalid behaviour mode key, please check the behaviour modes!");
                }

                m_BehaviourModeKeyIsValid = false;
            }
            else
            {
                m_BehaviourModeKeyIsValid = true;

                if (ActiveBehaviourModeKey != _key || !ActiveBehaviourIsReady)
                {
                    if (SetDesignatedBehaviourModeByKey(_key) == null)
                    {
                        PrintDebugLog(this, "SetBehaviourModeByKey : Behaviour Mode '" + m_DesignatedBehaviourModeKey + "' not exists, please check this behaviour mode!");
                    }
                    else if (m_DesignatedBehaviourMode == null || m_DesignatedBehaviourMode.ValidRules.Count == 0)
                    {
                        PrintDebugLog(this, "SetBehaviourModeByKey : Behaviour Mode '" + m_DesignatedBehaviourModeKey + "' have no valid rules, please check its behaviour modes rules!");
                    }
                    else
                    {
                        // stops the current behaviour mode include its active rules
                        if (m_ActiveBehaviourMode != null)
                        {
                            BehaviourAnimation.Stop(m_ActiveBehaviourMode.Rule.Animation);
                            m_ActiveBehaviourMode.Stop();
                        }

                        //BehaviourAudioPlayer.Stop();

                        m_LastBehaviourMode   = m_ActiveBehaviourMode;
                        m_ActiveBehaviourMode = m_DesignatedBehaviourMode;

                        // initialize the active behaviour mode
                        m_ActiveBehaviourMode.Start(OwnerComponent);

                        // initialize the active behaviour mode rule
                        NextBehaviorModeRule(true);

                        m_BehaviourTimer = 0;

                        m_BehaviourModeRulesChanged = true;
                        m_BehaviourModeChanged      = true;
                        _behaviour_mode_changed     = true;

                        if (OnBehaviourModeChanged != null)
                        {
                            OnBehaviourModeChanged(Owner, m_ActiveBehaviourMode, m_LastBehaviourMode);
                        }
                    }
                }
            }

            return(_behaviour_mode_changed);
        }
コード例 #18
0
ファイル: FacadeTrashCan.cs プロジェクト: Hosomy17/STW
 public static void ChangeColor(ClassTrashCan dataTrashCan, string color)
 {
     BehaviourAnimation.Play(dataTrashCan.gameObject, "Color_" + color);
 }
コード例 #19
0
ファイル: ControllerTrashCan.cs プロジェクト: Hosomy17/STW
    public void Point()
    {
        FacadeTrashCan.Score(classTrashCan);

        BehaviourAnimation.Float(earth, "Life", classTrashCan.life);
    }
コード例 #20
0
 private void EndLoadScreen()
 {
     BehaviourAnimation.Play(curtain, "Open");
 }
コード例 #21
0
 public void StartLoadScreen(string scene)
 {
     BehaviourAnimation.Play(curtain, "Close");
     StartCoroutine(LoadScene(scene));
 }