Inheritance: MonoBehaviour
Example #1
0
 private void Sttngs_Click(object sender, EventArgs e)
 {
     PlayAnimation.Hide(List);
     SetAnimation.ShowSync(Settings);
     HAnimator.Hide(HP);
     BAnimator.ShowSync(PList);
 }
Example #2
0
 private void bunifuImageButton5_Click(object sender, EventArgs e)
 {
     PlayAnimation.ShowSync(List);
     SetAnimation.Hide(Settings);
     HAnimator.Hide(HP);
     BAnimator.ShowSync(PList);
 }
Example #3
0
 private void stopPlayButton_Tap(object sender, System.Windows.Input.GestureEventArgs e) //TODO: Merge with finalized stop/start button
 {
     if (timerRunning)
     {
         timer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
         recTimer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
         micTimer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
         PlayAnimation.Stop();
         viewModel.AudioMan.StopClick();
         viewModel.AudioMan.StopAll();
         timerRunning = false;
         if (recording)
         {
             if (!starting)
             {
                 viewModel.AudioMan.RecordStop();
             }
             recording = false;
             starting  = false;
         }
         //stopPlayImage.Source = "/Assets/play.png"; //TODO: Change background of button
     }
     else
     {
         timer.Change(0, 4000);
         timerRunning = true;
         //stopPlayImage.Source = "/Assets/stop.png";
     }
 }
Example #4
0
        private void FinalizeButton_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            timer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
            recTimer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
            micTimer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
            PlayAnimation.Stop();
            viewModel.AudioMan.StopClick();
            viewModel.AudioMan.StopAll();
            timerRunning = false;
            VisualStateManager.GoToState(this, "Stopped", false); //TODO: Change this to ViewModel State
            MessageBoxResult sure = MessageBox.Show("Are you sure you want to finalize? This will mix your tracks down and delete the individual files.", "Finalize?", MessageBoxButton.OKCancel);

            if (sure == MessageBoxResult.OK)
            {
                //Mix-down and deletion code
                viewModel.AudioMan.FinalizeBank(viewModel.SelectedBank.bankID);
                viewModel.SelectedBank.Finalized = true;

                timer.Dispose();
                recTimer.Dispose();
                micTimer.Dispose();
                OffsetTextBlock.Text = "0".ToString();

                VisualStateManager.GoToState(this, "Finalized", true);

                byte[] trackData;
                int    trackLength = viewModel.AudioMan.GetBankAudioData(viewModel.SelectedBank.bankID, out trackData);
                viewModel.SelectedBank.finalTrack = trackData;
                viewModel.SelectedBank.Size       = trackLength;
                viewModel.SelectedBank.Pitch      = viewModel.AudioMan.GetPitchSemitones(viewModel.SelectedBank.bankID);
                viewModel.SelectedBank.Offset     = viewModel.AudioMan.GetBankOffsetMS(viewModel.SelectedBank.bankID);
                viewModel.SelectedBank.Volume     = viewModel.AudioMan.GetBankVolumeDB(viewModel.SelectedBank.bankID);
            }
        }
    /// <name>
    /// Start
    /// </name>
    /// <summary>
    /// Use this for initialization
    /// </summary>
    /// <author>
    /// Sabrina Hemming
    /// </author>
    /// <date>
    /// 2/12/18
    /// </date>
    void Start()
    {
        // get access to script on Chest and Coin object to play it's animation
        coinScript  = coinGO.GetComponent <PlayAnimation> ();
        chestScript = chestGO.GetComponent <PlayAnimation> ();

        // get access to saved addition game info to update
        gameStats    = gameStatsGO.GetComponent <GlobalControl> ();
        additionGame = gameStats.savedGameData.addition;

        // add a listener for when user clicks enter button
        enterButton
        .onClick
        .AddListener(CheckAnswer);

        // add a listener for when user clicks exit button
        exitButton
        .onClick
        .AddListener(ExitGame);

        // get the input field as a game object and an input field object
        GameObject inputFieldGO = GameObject.Find(Constants.INPUT);

        InputFieldCO = inputFieldGO.GetComponent <InputField> ();

        isFocused = false;


        score.text = additionGame.correctAnswers.ToString();

        // get the first math equation and set the text
        equation         = new MathEquation(additionGame.increaseRange, additionGame.level, MathEquation.EquationType.Addition);
        mathProblem.text = equation.EquationString;
    }
Example #6
0
 private void Help_Click(object sender, EventArgs e)
 {
     BAnimator.ShowSync(PList);
     SetAnimation.Hide(Settings);
     PlayAnimation.Hide(List);
     HAnimator.ShowSync(HP);
 }
    public static void SetAnimations(Texture2D givenTexture)
    {
        Color     animationColour        = transparent;
        Rect      currentAnimationBorder = new Rect(new Vector2(0, 0), new Vector2(givenTexture.width, 0));
        SpriteMap currentSpriteMap       = new SpriteMap();

        for (int i = 0; i <= givenTexture.height; i++)
        {
            Color pixelColour = givenTexture.GetPixel(0, i);
            if (pixelColour.a == 0)
            {
                if (i - currentAnimationBorder.y > 0)
                {
                    if (animationColour.a != 0)
                    {
                        if (animationColour != currentSpriteMap.GetColour())
                        {
                            currentSpriteMap = new SpriteMap();
                            currentSpriteMap.Initialise(givenTexture.name, animationColour);
                            layerList.Add(currentSpriteMap.m_index, currentSpriteMap);
                        }
                        currentAnimationBorder.size = new Vector2(currentAnimationBorder.size.x, i - currentAnimationBorder.y - 1);
                        PlayAnimation currentAnimation = SetAnimation(currentAnimationBorder, animationColour, givenTexture);
                        currentSpriteMap.AddAnimation(currentAnimation);
                    }
                }
                while (givenTexture.GetPixel(0, i).a == 0)
                {
                    i++;
                    if (i == givenTexture.height)
                    {
                        break;
                    }
                }
                currentAnimationBorder.y = i;
                animationColour          = pixelColour;
            }
            else if (i == givenTexture.height)
            {
                if (pixelColour.a == 0)
                {
                    throw new TextureNotfoundException(givenTexture.name + " didn't find any textures to make an animation from");
                }
                if (animationColour != currentSpriteMap.GetColour())
                {
                    currentSpriteMap = new SpriteMap();
                    currentSpriteMap.Initialise(givenTexture.name, animationColour);
                    layerList.Add(currentSpriteMap.m_index, currentSpriteMap);
                }
                currentAnimationBorder.size = new Vector2(currentAnimationBorder.size.x, i - currentAnimationBorder.y - 1);
                Rect          currentFrameBorder = new Rect(currentAnimationBorder.position, new Vector2(0, currentAnimationBorder.size.y));
                PlayAnimation currentAnimation   = SetAnimation(currentAnimationBorder, animationColour, givenTexture);
                currentSpriteMap.AddAnimation(currentAnimation);
            }
            else
            {
                animationColour = pixelColour;
            }
        }
    }
Example #8
0
 void Start()
 {
     rgb2             = this.GetComponent <Rigidbody2D>();
     healthController = GameObject.FindWithTag(MyConst.PlayerBody).GetComponent <HealthController>();
     playAnimation    = GetComponentInChildren <PlayAnimation>();
     cam = GetComponentInChildren <MoveCamera>();//  GameObject.FindWithTag("MainCamera").GetComponent<MoveCamera>();
     SetStartVariables();
 }
Example #9
0
    private ActionNode Attack(string attack)
    {
        PlayAnimation attackAnimation1 = new PlayAnimation(gameObject, attack);

        //PlayerAround nextToPlayer = new PlayerAround(attackAnimation1, gameObject, enemy, stoppingDistance);
        //Repeater repeatAttack = new Repeater(attackAnimation1);
        return(attackAnimation1);
    }
Example #10
0
    void OnJoinedRoom()
    {
        StartGame();
        PlayAnimation doorScript = door.GetComponent <PlayAnimation> ();

        doorScript.openDoor = true;
        doorScript.isOpen   = false;
        Time.timeScale      = 1.0f;
    }
Example #11
0
    public void AnimateRandom()
    {
        int           i    = (int)Mathf.Floor(Random.Range(0, animations.Count));
        AnimationClip clip = animations[i];

        PlayAnimation anim = GetComponent <PlayAnimation>();

        anim.PlayClip(clip, true);
    }
Example #12
0
 private void Awake()
 {
     this._playAnimation = this.GetComponent <PlayAnimation>();
     this._collider      = this.GetComponent <Collider>();
     this._interactable  = this.GetComponent <Interactable>();
     this._material      = this.GetComponent <Renderer>().material;
     foreach (Renderer renderer in this._powerCables)
     {
         this._materials.Add(renderer.material);
     }
 }
Example #13
0
 //  private Action<RealtivePosition> callFun;
 public void PlayCard()//出牌
 {
     cardState = CardState.Play_State;
     if (playCardAnim == null)
     {
         playCardAnim = new PlayAnimation();
         playCardAnim.handlerAnimFinish = AnimFinsh;
     }
     playCardAnim.init(gameObjectSelf);
     playCardAnim.SetTargetPosition(PlayePosition);
     playCardAnim.BeginAnim();
 }
Example #14
0
    private Node IdleMotion()
    {
        MoveToPositionInArea moveToPosition = new MoveToPositionInArea(gameObject, area);
        PlayAnimation        walkAnimation  = new PlayAnimation(gameObject, walk);
        //PlayerNotAround playerNotAround = new PlayerNotAround(moveToPosition, gameObject, enemy, playerDistance);
        Sequence idle = new Sequence(new List <Node> {
            moveToPosition, walkAnimation
        });

        move = new OutcomeEquals(idle, 3);
        return(move);
    }
Example #15
0
    public static PlayAnimation SetAnimation(Rect currentAnimationBorder, Color animationColour, Texture2D givenTexture)
    {
        PlayAnimation output = new PlayAnimation();

        output.Initialise();
        Rect  currentFrameBorder = new Rect(currentAnimationBorder.position, new Vector2(0, currentAnimationBorder.size.y));
        Color pixelColour        = transparent;

        for (int j = 0; j < currentAnimationBorder.size.x; j++)
        {
            pixelColour = givenTexture.GetPixel(j, (int)currentFrameBorder.y);
            if (animationColour != pixelColour)
            {
                if (pixelColour == transparent)
                {
                    if (currentFrameBorder.size.x < 1)
                    {
                        currentFrameBorder.size = new Vector2(j, currentFrameBorder.size.y);
                    }
                    Rect imageBorder = new Rect(new Vector2(currentFrameBorder.x + 1, currentFrameBorder.y + 1),
                                                new Vector2(currentFrameBorder.size.x - 2, currentFrameBorder.size.y - 2));
                    output.AddFrame(givenTexture, imageBorder);
                    j += XGAP - 1;
                    currentFrameBorder.x = j + 1;
                }
            }
            else if (j == currentAnimationBorder.size.x - 1)
            {
                if (animationColour != pixelColour && pixelColour != transparent)
                {
                    throw new TextureNotfoundException(givenTexture.name + " didn't find any textures to make a frame from");
                }
                if (currentFrameBorder.size.x < 1)
                {
                    currentFrameBorder.size = new Vector2(j, currentAnimationBorder.size.y);
                    currentFrameBorder      = new Rect(new Vector2(currentFrameBorder.x + 1, currentFrameBorder.y + 1),
                                                       new Vector2(currentFrameBorder.size.x - 1, currentFrameBorder.size.y - 1));
                }
                output.AddFrame(givenTexture, currentFrameBorder);
                j += XGAP - 1;
                currentFrameBorder.x = j + 1;
            }
            else
            {
                if (currentFrameBorder.size.x > 2)
                {
                    //Debug.Log("skip");
                    j += (int)currentFrameBorder.size.x - 2;
                }
            }
        }
        return(output);
    }
Example #16
0
    //SETUP===================================================================
    private void Start()
    {
        this.anim = GetComponentInChildren <PlayAnimation>();
        this.anim.AnimationFinished += AnimFin;

        this.startTile     = this.curTile;
        this.startPosition = this.transform.position;

        this.EndPosition = this.EndTile.transform.position;

        CanMove      = false;
        MoveDistance = 0;
    }
 static int PlayAnimationByName(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         PlayAnimation obj  = (PlayAnimation)ToLua.CheckObject <PlayAnimation>(L, 1);
         string        arg0 = ToLua.CheckString(L, 2);
         obj.PlayAnimationByName(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #18
0
    public static void SetAnimations(Sprite givenSprite, ref Dictionary <string, SpriteMap> givenDictionary)
    {
        Color     animationColour        = transparent;
        Rect      currentAnimationBorder = new Rect(new Vector2(0, 0), new Vector2(givenSprite.rect.size.x, 0));
        SpriteMap currentSpriteMap       = new SpriteMap();
        string    currentSpriteMapId;

        for (int i = 0; i < givenSprite.rect.size.y; i++)
        {
            Color pixelColour = givenSprite.texture.GetPixel(0, i);
            if (animationColour != pixelColour)
            {
                if (pixelColour != transparent)
                {
                    if (animationColour != transparent)
                    {
                        currentSpriteMapId = currentSpriteMap.GetName() + ColourToString(currentSpriteMap.GetColour());
                        givenDictionary.Add(currentSpriteMapId, currentSpriteMap);
                    }
                    animationColour          = pixelColour;
                    currentAnimationBorder.y = i;
                    currentSpriteMap.Initialise(givenSprite.name, animationColour);
                }
                else
                {
                    currentAnimationBorder.size = new Vector2(currentAnimationBorder.size.x, i - currentAnimationBorder.y);
                    PlayAnimation currentAnimation = SetAnimation(currentAnimationBorder, animationColour, givenSprite.texture);
                    currentSpriteMap.AddAnimation(currentAnimation);
                    i += YGAP - 1;
                    currentAnimationBorder.y = i + 1;
                }
            }
            else if (i == givenSprite.rect.size.y - 1)
            {
                if (pixelColour == transparent)
                {
                    throw new TextureNotfoundException(givenSprite.name + " didn't find any textures to make an animation from");
                }
                currentAnimationBorder.size = new Vector2(currentAnimationBorder.size.x, i - currentAnimationBorder.y);
                Rect          currentFrameBorder = new Rect(currentAnimationBorder.position, new Vector2(0, currentAnimationBorder.size.y));
                PlayAnimation currentAnimation   = SetAnimation(currentAnimationBorder, animationColour, givenSprite.texture);
                currentSpriteMap.AddAnimation(currentAnimation);
                i += YGAP - 1;
            }
        }
        currentSpriteMapId = currentSpriteMap.GetName() + ColourToString(currentSpriteMap.GetColour());
        givenDictionary.Add(currentSpriteMapId, currentSpriteMap);
    }
 public RoleModel(string role_name)
 {
     if (role_name == "priest")
     {
         role      = Object.Instantiate(Resources.Load("Priest", typeof(GameObject)), Vector3.zero, Quaternion.Euler(0, 180, 0)) as GameObject;
         role_sign = 0;
     }
     else
     {
         role      = Object.Instantiate(Resources.Load("Devil", typeof(GameObject)), Vector3.zero, Quaternion.Euler(0, 180, 0)) as GameObject;
         role_sign = 1;
     }
     //move = role.AddComponent(typeof(Move)) as Move;
     click    = role.AddComponent(typeof(Click)) as Click;
     play_ani = role.AddComponent(typeof(PlayAnimation)) as PlayAnimation;
     click.SetRole(this);
 }
Example #20
0
 private void Start()
 {
     changeImage = GetComponent <ChangeImage> ();
     animation   = GetComponent <PlayAnimation> ();
     sound       = GetComponent <TransitionSound> ();
     leftButton.onClick.AddListener(delegate()
     {
         changeImage.PreviousImage();
         animation.AniStart();
         sound.Play();
     });
     rightButton.onClick.AddListener(delegate()
     {
         changeImage.NextImage();
         animation.AniStart();
         sound.Play();
     });
 }
    public static PlayAnimation SetAnimation(Rect currentAnimationBorder, Color animationColour, Texture2D givenTexture)
    {
        PlayAnimation output = new PlayAnimation();

        output.Initialise();
        Rect  currentFrameBorder = new Rect(new Vector2(0, currentAnimationBorder.y), new Vector2(0, currentAnimationBorder.size.y));
        Color pixelColour        = transparent;

        for (int i = 0; i <= currentAnimationBorder.size.x; i++)
        {
            Color currentPixel = givenTexture.GetPixel(i, (int)currentFrameBorder.y);
            if (currentPixel.a == 0)
            {
                if (i - currentFrameBorder.x > 0)
                {
                    Rect imageBorder = new Rect(new Vector2(currentFrameBorder.position.x + 1, currentFrameBorder.y + 1),
                                                new Vector2(i - currentFrameBorder.x - 2, currentFrameBorder.size.y - 1));
                    output.AddFrame(givenTexture, imageBorder);
                }
                while (givenTexture.GetPixel(i, (int)currentFrameBorder.y).a == 0)
                {
                    i++;
                    if (i >= currentAnimationBorder.size.x)
                    {
                        break;
                    }
                }
                currentFrameBorder.x = i;
            }
            else if (i == currentAnimationBorder.size.x)
            {
                if (animationColour != pixelColour && pixelColour.a != 0)
                {
                    throw new MalformedTextureException(givenTexture.name + " doesn't terminate appropiately");
                }
                Rect imageBorder = new Rect(new Vector2(currentFrameBorder.position.x, currentFrameBorder.y),
                                            new Vector2(i - currentFrameBorder.x - 2, currentFrameBorder.size.y - 1));
                output.AddFrame(givenTexture, imageBorder);
            }
        }
        return(output);
    }
    void OnWizardCreate()
    {
        DialogItem first = items[0];
        DialogItem last = items[items.Count - 1];
        if (mainGameObject != null)
        {
            StopNav nav = new StopNav();
            nav.Initilize(ref first, NodeActionType.OnDialogFocused);
            nav.SetNodeTarget(ref mainGameObject);
            first.onNodeFocusedActions.Add(nav);
        }
        if (mainGameObject != null && lookAtTarget != null)
        {
            LookAtGameObject lookAt = new LookAtGameObject();
            lookAt.Initilize(ref first, NodeActionType.OnDialogFocused);
            lookAt.SetLooker(ref mainGameObject);
            lookAt.SetTarget(ref lookAtTarget);
            first.onNodeFocusedActions.Add(lookAt);
        }
        if (animationToPlay != "")
        {
            PlayAnimation anim = new PlayAnimation();
            anim.Initilize(ref first, NodeActionType.OnDialogFocused);
            anim.SetNodeTarget(ref mainGameObject);
            first.onNodeFocusedActions.Add(anim);

        }
        if (animationLeave != "")
        {
            PlayAnimation anim = new PlayAnimation();
            anim.Initilize(ref last, NodeActionType.OnDialogLeave);
            anim.SetNodeTarget(ref mainGameObject);
            last.onNodeLeaveActions.Add(anim);
        }
        if (mainGameObject != null)
        {
            EndConvoActions end = new EndConvoActions();
            end.Initilize(ref last, NodeActionType.OnDialogLeave);
            last.onNodeLeaveActions.Add(end);
        }
        CleanUp();
    }
Example #23
0
        private void Progress_Go(object state)
        {
            System.Diagnostics.Debug.WriteLine("Progress_go ticked, there are  " + viewModel.SelectedBank.tracks.Count + " tracks in bank " + viewModel.SelectedBank.bankID + ".");
            Dispatcher.BeginInvoke(delegate
            {
                foreach (Track t in viewModel.SelectedBank.tracks)
                {
                    t.Finalized = true;
                }
                PlayAnimation.Stop();
                progressBar.Value = 0;
                PlayAnimation.Begin();
                viewModel.AudioMan.StopAll();
                viewModel.AudioMan.PlayBank(viewModel.SelectedBank.bankID); //TODO: This should be PlayMixedDownBank?
                viewModel.AudioMan.SetClickVolume(MetronomeSlider.IsChecked == true ? 1 : 0);
            });

            micTimer.Change(3950, System.Threading.Timeout.Infinite);

            viewModel.AudioMan.PlayClick();
        }
Example #24
0
 private void MnuBtn_Click(object sender, EventArgs e)
 {
     if (MnuPanel.Width == 225)
     {
         BAnimator.Hide(PList);
         MnuPanel.Visible = false;
         MnuPanel.Width   = 45;
         MnuAnimator.ShowSync(MnuPanel);
         PlayAnimation.Hide(List);
         HAnimator.Hide(HP);
         SetAnimation.Hide(Settings);
     }
     else
     {
         HAnimator.Hide(HP);
         PlayAnimation.Hide(List);
         MnuPanel.Visible = false;
         MnuPanel.Width   = 225;
         MnuAnimator.ShowSync(MnuPanel);
         BAnimator.ShowSync(PList);
     }
 }
Example #25
0
 public void PlayAnimation(PlayAnimation anim)
 {
     if (this.animCtrl == null)
     {
         return;
     }
     if (this.lastAnimation != null && this.lastAnimation.priority > anim.priority)
     {
         return;
     }
     if (string.IsNullOrEmpty(anim.AnimName))
     {
         return;
     }
     if (anim.replay && this.animCtrl.IsPlaying(anim.AnimName))
     {
         this.animCtrl.Stop();
     }
     this.animState = this.animCtrl[anim.AnimName];
     if (this.animState == null)
     {
         return;
     }
     if (this.actorCtrler != null)
     {
         this.animState.speed = this.actorCtrler.AttackSpeed;
     }
     if (anim.BlendTime < 0.001f)
     {
         this.animCtrl.Play(anim.AnimName, anim.PlayMode);
     }
     else
     {
         this.animCtrl.CrossFade(anim.AnimName, anim.BlendTime, anim.PlayMode);
     }
     this.animCtrl.wrapMode = anim.WrapMode;
     this.lastAnimation = anim;
 }
Example #26
0
 private void LongListSelector_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (((Track)loopList.SelectedItem) != null)
     {
         if (e.RemovedItems[0] != null)
         {
             ((Track)e.RemovedItems[0]).IsSelected = false;
         }
         VisualStateManager.GoToState(this, "TrackSelected", true);
         PlayAnimation.Stop();
         MetronomeSlider.IsChecked = false;
         viewModel.AudioMan.StopAll();
         viewModel.AudioMan.StopClick();
         viewModel.SelectedTrack            = ((Track)loopList.SelectedItem);
         viewModel.SelectedTrack.IsSelected = true;
         timer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
         recTimer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
         micTimer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
         timerRunning         = false;
         VolumeSlider.Value   = viewModel.SelectedTrack.Volume;
         OffsetTextBlock.Text = viewModel.SelectedTrack.Offset.ToString();
     }
 }
Example #27
0
 public static void PlayAnimation(SkillVariables variables, PlayAnimation anim)
 {
     AnimationController animationCtrler = variables.skillCaster.AnimationCtrler;
     if (animationCtrler != null)
     {
         animationCtrler.PlayAnimation(anim);
     }
     else
     {
         GameObject gameObject = variables.skillCaster.gameObject;
         if (gameObject && gameObject.animation)
         {
             if (anim.BlendTime < 0.001f)
             {
                 gameObject.animation.Play(anim.AnimName, anim.PlayMode);
             }
             else
             {
                 gameObject.animation.CrossFade(anim.AnimName, anim.BlendTime, anim.PlayMode);
             }
             gameObject.animation.wrapMode = anim.WrapMode;
         }
     }
 }
Example #28
0
 public CardState BeginSelect()
 {
     if (cardState == CardState.None_State)
     {
         if (cardAnim == null)
         {
             cardAnim = new SelectAnimation();
             cardAnim.handlerAnimFinish = AnimFinsh;
         }
         cardAnim.init(gameObjectSelf);
         cardAnim.BeginAnim();
         cardState = CardState.Select_State;
     }
     else if (cardState == CardState.Select_State)
     {
         if (playCardAnim == null)
         {
             playCardAnim = new PlayAnimation();
             playCardAnim.handlerAnimFinish = AnimFinsh;
         }
         cardState = CardState.Play_State;
     }
     return(cardState);
 }
    // Use this for initialization
    void Start()
    {
        eventManager = FindObjectOfType <EventManager>();
        navAgent     = GetComponent <NavMeshAgent>();
        player       = FindObjectOfType <Player>();
        body         = GetComponent <Rigidbody>();
        triggerTag   = "Player";
        m_waypoints.TrimExcess();
        Debug.Log("Start target tag: " + triggerTag);

        animator = GetComponent <Animator>();

        // Detects if eye location is set
        if (!m_eyeLocation)
        {
            Debug.Log("Eye Location is not set");
        }

        // Detects if waypoints are set
        if (m_waypoints.Count < 1)
        {
            Debug.Log("Waypoints are not set");
        }

        //----------------------------------------------------
        // The Attack Sequence

        // Set triggers to turn off
        List <string> offTriggers = new List <string>();

        offTriggers.Add("Search");
        offTriggers.Add("Chase");

        // Set up the attack behaviour
        PlayAnimation attackAnimation = new PlayAnimation();

        attackAnimation.SetParameters(animator, "DeathSequence", offTriggers);

        // Set up condition for the attack sequence
        Triggered attackCondition = new Triggered();

        // Set up attack sequence
        Sequence attackSequence = new Sequence();

        attackSequence.addBehaviour(attackCondition);
        attackSequence.addBehaviour(attackAnimation);

        // ---------------------------------------------------
        // The Drill Sequence

        // Set up the drill condition
        DrillBehaviour drillBehaviour = new DrillBehaviour();

        drillBehaviour.SetParameters(false);

        // Set up drill animation
        PlayAnimation drillAnimation = new PlayAnimation();

        drillAnimation.SetParameters(animator, "DrillSequence", null, onDoorDrilling);

        // Set up drill sequence
        Sequence drillSequence = new Sequence();

        drillSequence.addBehaviour(drillBehaviour);
        //drillSequence.addBehaviour(seekPanel);
        drillSequence.addBehaviour(drillAnimation);

        // ---------------------------------------------------
        // The Rage Sequence

        // Set up the rage condition
        DrillBehaviour rageBehaviour = new DrillBehaviour();

        rageBehaviour.SetParameters(true);

        // Set up rage animation
        PlayAnimation rageAnimation = new PlayAnimation();

        rageAnimation.SetParameters(animator, "RageSequence");

        // Set up rage sequence
        Sequence rageSequence = new Sequence();

        rageSequence.addBehaviour(rageBehaviour);
        rageSequence.addBehaviour(rageAnimation);

        //----------------------------------------------------
        // The Proximity Sequence

        // Set up within range condition for search sequence
        WithinRange withinSearch = new WithinRange();

        withinSearch.SetParameters(player.gameObject, m_searchRange);

        // Set up line of sight condition for search sequence
        LineOfSight inSight = new LineOfSight();

        inSight.SetParameters(player.gameObject, m_sightRange, m_eyeLocation);

        // Set up the close chase behaviour
        SetTargetBehaviour closeChase = new SetTargetBehaviour();

        closeChase.SetParameters(player.gameObject, m_searchSpeed, "CloseChase", onProximityDetection);

        // Set up arm extended animation
        PlayAnimation armExtended = new PlayAnimation();

        armExtended.SetParameters(animator, "ArmExtended");

        // Set up chase sequence
        Sequence closeChaseSequence = new Sequence();

        closeChaseSequence.addBehaviour(withinSearch);
        closeChaseSequence.addBehaviour(inSight);
        closeChaseSequence.addBehaviour(closeChase);
        closeChaseSequence.addBehaviour(armExtended);

        //----------------------------------------------------
        // The Search Sequence

        // Turn towards the player
        FaceTarget facePlayer = new FaceTarget();

        facePlayer.SetParameters(player.gameObject, m_rotationSpeed);

        // Set up arm extended animation
        PlayAnimation searchAnimation = new PlayAnimation();

        searchAnimation.SetParameters(animator, "Search", null, searching);

        // Set up search sequence
        Sequence searchSequence = new Sequence();

        searchSequence.addBehaviour(withinSearch);
        searchSequence.addBehaviour(facePlayer);
        searchSequence.addBehaviour(searchAnimation);

        //----------------------------------------------------
        // The Chase Sequence

        // Set up the chase behaviour
        SetTargetBehaviour chasePlayer = new SetTargetBehaviour();

        chasePlayer.SetParameters(player.gameObject, m_chaseSpeed, "Chase", chasing);

        // Set up within range condition for chase sequence
        WithinRange withinChase = new WithinRange();

        withinChase.SetParameters(player.gameObject, m_sightRange);

        // Set up chase sequence
        Sequence chaseSequence = new Sequence();

        chaseSequence.addBehaviour(withinChase);
        chaseSequence.addBehaviour(inSight);
        chaseSequence.addBehaviour(chasePlayer);

        //----------------------------------------------------
        // The Investigate Sequence

        // Set up alert condition
        AlertCondition alertCondition = new AlertCondition();

        // Set up investigate sequence
        Sequence investigateSequence = new Sequence();

        investigateSequence.addBehaviour(alertCondition);
        investigateSequence.addBehaviour(m_investigateArea);


        //----------------------------------------------------
        // The Patrol Sequence
        // Set up the patrol targets
        Patrol patrolDestination = new Patrol();

        patrolDestination.SetParameters(m_waypoints);

        // Set up the patrol behaviour
        SetTargetBehaviour patrolBehaviour = new SetTargetBehaviour();

        patrolBehaviour.SetParameters(patrolDestination, m_patrolSpeed, "Patrol", patrolling);

        // Look for nearest waypoint then continue with the patrol from there

        //----------------------------------------------------
        // The Main Selector

        // Set up main selector
        Selector mainSelector = new Selector();

        mainSelector.addBehaviour(attackSequence);
        mainSelector.addBehaviour(drillSequence);
        mainSelector.addBehaviour(rageSequence);
        mainSelector.addBehaviour(closeChaseSequence);
        mainSelector.addBehaviour(searchSequence);
        mainSelector.addBehaviour(chaseSequence);
        mainSelector.addBehaviour(investigateSequence);
        mainSelector.addBehaviour(patrolBehaviour);

        // Add all sequences to the behaviour list
        m_behaviours.Add(mainSelector);
    }
Example #30
0
 private void Awake()
 {
     this._playAnimation = this.GetComponent <PlayAnimation>();
 }
Example #31
0
    // Update is called once per frame
    void Update()
    {
        //numberOfKeys.text = keys.ToString();
        if (Input.GetKeyDown(KeyCode.Mouse0))
        {
            Ray        ray = new Ray(transform.position, transform.forward);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit, length))
            {
                if (hit.collider.CompareTag("Door"))
                {
                    DoorScript doorScript = hit.collider.transform.parent.GetComponent <DoorScript>();

                    if (doorScript == null)
                    {
                        return;
                    }

                    if (Inventory.keys[doorScript.index] == true)
                    {
                        doorScript.ChangeDoorState();
                        FindObjectOfType <AudioManager>().Play("OpenDoor");
                    }
                    else
                    {
                        FindObjectOfType <AudioManager>().Play("LockedDoor");
                    }

                    //Debug.Log("Colidi");
                    //player.ChangeCameraStateTrue();
                }

                else if (hit.collider.CompareTag("FinalDoor"))
                {
                    DoorScript doorScript = hit.collider.transform.parent.GetComponent <DoorScript>();

                    if (doorScript == null)
                    {
                        return;
                    }

                    if (Inventory.keys[doorScript.index] == true && soundEmitter >= 4 && imagePuzzle.valorFinal == 5)
                    {
                        doorScript.ChangeDoorState();
                        FindObjectOfType <AudioManager>().Play("OpenDoor");
                    }
                    else
                    {
                        FindObjectOfType <AudioManager>().Play("LockedDoor");
                        if (!textIsOnScreen)
                        {
                            textIsOnScreen = true;
                            finalDoorText.SetActive(true);
                            StartCoroutine(WaitForSec());
                        }
                    }

                    Debug.Log("Colidi");
                    //player.ChangeCameraStateTrue();
                }
                else if (hit.collider.CompareTag("Key"))
                {
                    Inventory.keys[hit.collider.GetComponent <KeyScript>().index] = true;
                    if (!textIsOnScreen)
                    {
                        textIsOnScreen = true;
                        uiObject.SetActive(true);
                        StartCoroutine("WaitForSec");
                    }
                    //Debug.Log("ColidiCarai");
                    //Destroy(gameObject);
                    FindObjectOfType <AudioManager>().Play("GetKey");

                    KeyScript keyScript = hit.collider.transform.GetComponent <KeyScript>();
                    keyScript.DestroyKey();
                    keys++;
                }

                //Interactable intercactable = hit.collider.GetComponent<Interactable>();

                else if (hit.collider.CompareTag("AnimInteractable"))
                {
                    PlayAnimation animation = hit.collider.transform.GetComponent <PlayAnimation>();
                    animation.AnimPlay();
                    Debug.Log("TaFuncionando"); //Não ta funcionando ;-; T-T
                }

                else if (hit.collider.CompareTag("Sink") && isCarryingWater == false)
                {
                    if (waterIsWorking)
                    {
                        isCarryingWater = true;
                        Debug.Log("PEGUEI A AGUA");
                        if (!textIsOnScreen)
                        {
                            textIsOnScreen = true;
                            uiObject2.SetActive(true);
                            StartCoroutine("WaitForSec");
                        }
                        glassIcon.SetActive(true);
                        trigger2.SetActive(true);
                    }
                    else
                    {
                        if (!textIsOnScreen)
                        {
                            textIsOnScreen = true;
                            uiObject3.SetActive(true);
                            StartCoroutine("WaitForSec");
                        }
                    }
                }

                else if (hit.collider.CompareTag("Fire"))
                {
                    if (isCarryingWater == true)
                    {
                        FireScript fireParticles = hit.collider.transform.GetComponent <FireScript>();
                        fireParticles.DestroyFire();
                        Debug.Log("APAGUEI O FOGO");
                        glassIcon.SetActive(false);
                        xGlassIcon.SetActive(true);
                        fireplaceKey.SetActive(true);
                        isCarryingWater = false;
                    }

                    else
                    {
                        if (!textIsOnScreen)
                        {
                            textIsOnScreen = true;
                            text3.SetActive(true);
                            StartCoroutine("WaitForSec");
                        }
                    }
                }

                else if (hit.collider.CompareTag("Regulator") && waterIsWorking == false)
                {
                    waterIsWorking = true;
                    Debug.Log("LIGUEI O REGISTRO");
                    if (!textIsOnScreen)
                    {
                        textIsOnScreen = true;
                        text.SetActive(true);
                        StartCoroutine("WaitForSec");
                    }
                    kitchenTable.SetActive(true);
                    normalTable.SetActive(false);
                    kitchenWater.SetActive(true);
                    //PoisonedWaterScript blackWater = hit.collider.transform.GetComponent<PoisonedWaterScript>();
                    //blackWater.DestroyWater();
                    //Debug.Log("RIP AGUA DA MORTE");
                    //waterTankKey.SetActive(true);
                    //normalWater.SetActive(true);
                    //fallingWater.SetActive(true);
                }

                else if (hit.collider.CompareTag("PoisonedWater"))
                {
                    if (waterIsWorking)
                    {
                        PoisonedWaterScript blackWater = hit.collider.transform.GetComponent <PoisonedWaterScript>();
                        blackWater.DestroyWater();
                        Debug.Log("RIP AGUA DA MORTE");
                        waterTankKey.SetActive(true);
                        normalWater.SetActive(true);
                        fallingWater.SetActive(true);
                    }

                    else
                    {
                        if (!textIsOnScreen)
                        {
                            textIsOnScreen = true;
                            text2.SetActive(true);
                            StartCoroutine("WaitForSec");
                        }
                    }
                }

                else if (hit.collider.CompareTag("MovableFloor"))
                {
                    FloorScript floor = hit.collider.transform.GetComponent <FloorScript>();
                    floor.DestroyFloor();
                    //secretCompartmentKey.SetActive(true);
                }

                else if (hit.collider.CompareTag("Text"))
                {
                    PrintMessage text = hit.collider.transform.GetComponent <PrintMessage>();

                    if (!textIsOnScreen)
                    {
                        textIsOnScreen = true;
                        text.ShowText();
                        StartCoroutine(WaitForSec());
                    }
                    //text.TextOnScreen();
                }

                // if (hit.collider.gameObject.name == "Boiler")
                // {
                // boiler.SetActive(false);
                //}

                else if (hit.collider.CompareTag("RightDoor"))
                {
                    DoorScript doorScript = hit.collider.transform.parent.GetComponent <DoorScript>();

                    if (doorScript == null)
                    {
                        return;
                    }
                    else
                    {
                        doorScript.PuzzleDoor();
                        pm.canMove = false;
                        StartCoroutine(WrongDoorEvent());
                        FindObjectOfType <AudioManager>().Play("OpenDoor");
                        FindObjectOfType <AudioManager>().Play("Right");
                        doorScript.ChangeGroup();
                    }

                    //player.ChangeCameraStateTrue();
                }

                else if (hit.collider.CompareTag("WrongDoor"))
                {
                    DoorScript doorScript = hit.collider.transform.parent.GetComponent <DoorScript>();

                    if (doorScript == null)
                    {
                        return;
                    }
                    else
                    {
                        Debug.Log(pm.transform.position);
                        doorScript.PuzzleDoor();
                        pm.canMove = false;
                        StartCoroutine(WrongDoorEvent());
                        FindObjectOfType <AudioManager>().Play("OpenDoor");
                        FindObjectOfType <AudioManager>().Play("Wrong");
                        //pm.SetPlayerSpeed(5);
                    }

                    //player.ChangeCameraStateTrue();
                }

                else if (hit.collider.CompareTag("SoundPuzzle"))
                {
                    Inventory.soundPuzzleObjects[hit.collider.GetComponent <SoundPuzzleScript>().index] = true;

                    SoundPuzzleScript soundPuzzle = hit.collider.transform.GetComponent <SoundPuzzleScript>();
                    soundPuzzle.ActivateIcon();
                    soundPuzzle.AddIndex();
                    soundPuzzle.DestroyObject();
                    uiObject4.SetActive(true);
                    FindObjectOfType <AudioManager>().Play("GetKey");
                    StartCoroutine("WaitForSec");
                    // soundEmitter++;
                }

                else if (hit.collider.CompareTag("NoiseEmitter"))
                {
                    NoiseEmitterScript noiseEmitterScript = hit.collider.transform.GetComponent <NoiseEmitterScript>();

                    if (noiseEmitterScript == null)
                    {
                        return;
                    }


                    if (Inventory.soundPuzzleObjects[noiseEmitterScript.index] == true)
                    {
                        soundEmitter++;
                        noiseEmitterScript.ActivateObject();
                        print(soundEmitter);
                        FindObjectOfType <AudioManager>().Play("Right");
                    }
                }
                // =======================Xylophone========================

                if (hit.collider.name == "XyloA")
                {
                    FindObjectOfType <AudioManager>().Play("XyloA");
                }

                if (hit.collider.name == "XyloB")
                {
                    FindObjectOfType <AudioManager>().Play("XyloB");
                }

                if (hit.collider.name == "XyloC")
                {
                    FindObjectOfType <AudioManager>().Play("XyloC");
                }

                if (hit.collider.name == "XyloD")
                {
                    FindObjectOfType <AudioManager>().Play("XyloD");
                }

                if (hit.collider.name == "XyloE")
                {
                    FindObjectOfType <AudioManager>().Play("XyloE");
                }

                if (hit.collider.name == "XyloF")
                {
                    FindObjectOfType <AudioManager>().Play("XyloF");
                }

                if (hit.collider.name == "XyloG")
                {
                    FindObjectOfType <AudioManager>().Play("XyloG");
                }
            }
        }

        if (soundEmitter == 4)
        {
            painting.SetActive(true);
        }
    }
Example #32
0
 private void Init()
 {
     this.initLocalScale = base.transform.localScale;
     this.navAgent = base.GetComponent<NavMeshAgentEx>();
     this.aiCtrler = base.GetComponent<AIController>();
     this.animationCtrler = base.GetComponent<AnimationController>();
     if (ActorController.deadAnimation == null)
     {
         ActorController.deadAnimation = new PlayAnimation();
         ActorController.deadAnimation.AnimName = "die";
         ActorController.deadAnimation.PlayMode = PlayMode.StopAll;
         ActorController.deadAnimation.WrapMode = WrapMode.ClampForever;
         ActorController.deadAnimation.priority = 10;
     }
     GameObject gameObject = Res.LoadGUI("GUI/HUDText");
     if (gameObject != null && GameUIManager.mInstance != null)
     {
         GameObject gameObject2 = NGUITools.AddChild(GameUIManager.mInstance.HUDTextMgr.gameObject, gameObject);
         this.uiText = gameObject2.GetComponent<HUDText>();
         this.uiText.Init();
         Vector3 localPosition = this.uiText.transform.localPosition;
         localPosition.z += 5000f;
         this.uiText.transform.localPosition = localPosition;
         gameObject2.AddComponent<UIFollowTarget>().target = base.gameObject.transform;
     }
     this.playerheadTip = base.gameObject.AddComponent<UIIngameActorHPMP>();
     this.playerheadTip.Init(this);
     this.playerheadTip.SpriteDepth = (int)((ActorController.HeadTipDepth += 4) % 100 + (1000 - (int)this.actorType * 100));
     GameObject gameObject3 = ObjectUtil.FindChildObject(base.gameObject, "Spine1");
     if (gameObject3 != null)
     {
         this.spineTransform = gameObject3.transform;
     }
     float num = 1f;
     if (this.actorType != ActorController.EActorType.ELopet)
     {
         if (this.factionType == ActorController.EFactionType.ERed)
         {
             if (this.IsBox)
             {
                 gameObject = Res.Load<GameObject>("Skill/st_027", false);
                 this.boxExplode = Res.Load<GameObject>("Skill/st_028", false);
             }
             else if (this.IsBoss)
             {
                 gameObject = Res.Load<GameObject>("Skill/st_007", false);
                 num = this.GetBoundsMinRadius() / 0.5f;
             }
             else
             {
                 gameObject = Res.Load<GameObject>("Skill/st_009", false);
                 num = this.GetBoundsMinRadius() / 0.275f;
             }
         }
         else if (this.ActorType == ActorController.EActorType.EPet)
         {
             gameObject = Res.Load<GameObject>("Skill/st_008", false);
             num = this.GetBoundsMinRadius() / 0.275f;
         }
         else
         {
             gameObject = Res.Load<GameObject>("Skill/st_008a", false);
         }
         if (gameObject != null)
         {
             this.feetEffect = Tools.AddChild(base.gameObject, gameObject);
         }
         if (this.feetEffect == null)
         {
             global::Debug.LogError(new object[]
             {
                 "Instantiate st_008 or st_009 or st_027 error"
             });
             return;
         }
         this.feetEffect.transform.rotation = Quaternion.identity;
         ParticleSystem[] componentsInChildren = this.feetEffect.GetComponentsInChildren<ParticleSystem>();
         for (int i = 0; i < componentsInChildren.Length; i++)
         {
             componentsInChildren[i].startSize *= num;
         }
     }
     gameObject = Res.Load<GameObject>("Skill/st_012", false);
     if (!(gameObject != null))
     {
         global::Debug.LogError(new object[]
         {
             "Res.Load Skill/st_012 error"
         });
         return;
     }
     this.runEffect = Tools.AddChild(base.gameObject, gameObject);
     if (this.runEffect == null)
     {
         global::Debug.LogError(new object[]
         {
             "Instantiate st_012 error"
         });
         return;
     }
     this.runEffect.SetActive(false);
     this.isDead = false;
     for (int j = 1; j < 11; j++)
     {
         this.UpdateAtt(j);
     }
     this.CurHP = this.MaxHP;
     this.CurMP = this.MaxMP;
     this.meshChanged = true;
 }
Example #33
0
 public SafeSpace(UrTile Tile)
 {
     this.Tile  = Tile;
     this.Anim  = Tile.GetComponentInChildren <PlayAnimation>();
     this.Sound = Tile.GetComponentInChildren <AudioPlayer>();
 }
Example #34
0
 public void StopAnimation()
 {
     this.lastAnimation = null;
 }
Example #35
0
 private void Update()
 {
     if (this.lastAnimation == null || this.animState == null || this.animCtrl == null)
     {
         this.UpdateBaseAnimation();
         return;
     }
     if (!this.animState.enabled || (this.animState.wrapMode == WrapMode.ClampForever && this.animState.time > this.animState.length))
     {
         this.lastAnimation = null;
         this.animState = null;
     }
 }
Example #36
0
 public void AddAnimation(PlayAnimation givenAnimation)
 {
     PlayAnimation[] temp = new PlayAnimation[m_animationList.Count + 1];
     m_animationList.Add(givenAnimation);
 }
Example #37
0
 public void PlayWin(bool pvp, bool win)
 {
     Quaternion rotation = Quaternion.identity;
     if (!pvp)
     {
         Globals.Instance.GameMgr.ClearSpeedMod();
     }
     else
     {
         Vector3 forward = -Camera.main.transform.forward;
         rotation = Quaternion.LookRotation(forward);
         rotation.x = 0f;
         rotation.z = 0f;
     }
     PlayAnimation playAnimation = new PlayAnimation();
     playAnimation.AnimName = "win";
     playAnimation.PlayMode = PlayMode.StopAll;
     playAnimation.WrapMode = WrapMode.Loop;
     playAnimation.priority = 10;
     int num = 0;
     int num2 = 5;
     if (!win)
     {
         num = 5;
         num2 = this.actors.Count;
     }
     for (int i = num; i < num2; i++)
     {
         if (this.actors[i] != null && !this.actors[i].IsDead)
         {
             if (pvp)
             {
                 this.actors[i].RotateTo(rotation);
             }
             if (this.actors[i].PlayerheadTip != null)
             {
                 this.actors[i].PlayerheadTip.IsWin = true;
             }
             this.actors[i].AnimationCtrler.PlayAnimation(playAnimation);
             this.AddActorCombatLog(this.actors[i]);
         }
     }
     if (win)
     {
         if (this.LopetActor != null)
         {
             this.LopetActor.RotateTo(rotation);
         }
     }
     else if (this.RemoteLopetActor != null)
     {
         this.RemoteLopetActor.RotateTo(rotation);
     }
     this.combatLog.EndTime = Globals.Instance.Player.GetTimeStamp();
     this.combatLog.KillMonsterCount = this.MonsterDead;
     this.combatLog.Win = ((!win) ? 0 : 1);
     this.invoker.DoInvoke(this, "OnPlayWinOver", 1.5f);
 }