Example #1
0
    public void SetCountdown(float duration)
    {
        int ticks = (int)duration;

        AnimController.ClearQueue();

        Setup();

        // Fade out top
        AnimController.AddAnim(new UiAnimationFade(Top.gameObject, 0.25f, UiAnimationFade.FadeType.Out), false);

        // Fade and scale in title simultaneously
        AnimController.AddAnim(new UiAnimationFade(ReadyTitle.gameObject, 0.5f, UiAnimationFade.FadeType.In), false);

        // Add countdowns
        for (int i = 0; i < ticks; i++)
        {
            // Make temp var
            var time = ticks - i;

            AnimController.AddDelay(1f);

            // Set timer text on every tick
            AnimController.AddAction("Set Timer Text", () => ReadyTimer.text = time.ToString());

            // Scale and fade in timer
            AnimController.AddAnim(new UiAnimationFade(ReadyTimer.gameObject, 0.1f, UiAnimationFade.FadeType.In), false);
            AnimController.AddAnim(new UiAnimationScale(ReadyTimer.gameObject, Vector3.one * 2, Vector3.one, 0.1f));
        }

        AnimController.PlayAnimations();
    }
Example #2
0
        protected override void CheckMoveState()
        {
            switch (_moveType)
            {
            case MoveState.FollowEnemy:
                AnimController.SetAnim(SoliderAnimState.Walk);
                FollowEnemy();
                break;

            case MoveState.CanAttack:
                AnimController.SetAnim(SoliderAnimState.Attack);
                Attack();
                break;

            case MoveState.WalkToFlag:
                AnimController.SetAnim(SoliderAnimState.Walk);
                WalkToFlag();
                break;

            case MoveState.FarOther:
                AnimController.SetAnim(SoliderAnimState.Walk);
                FarOther();
                break;

            case MoveState.Stop:
                AnimController.SetAnim(SoliderAnimState.Idle);
                break;
            }
        }
Example #3
0
    public static void PlayAnimAt(AnimationClip anim, Vector3 pos, bool isDialogueAction = false)
    {
        AnimController animController = Instantiate(UIManager.GenericAnimPrefab, pos, Quaternion.identity);

        animController.InitTemp();
        animController.PlayOneShot(anim, isDialogueAction);
    }
Example #4
0
 // Use this for initialization
 void Awake()
 {
     drag   = GetComponent <DragObjects> ();
     player = GetComponent <AnimController> ();
     OffLeftHand();
     OffRightHand();
 }
    /// <summary>
    /// Initiate movement to a given point.
    /// </summary>
    public virtual void MoveToPoint(Vector2 point, bool isDialogueAction = false)
    {
        if (Instance != this)
        {
            ((WorldItem)Instance).MoveToPoint(point, isDialogueAction);
        }
        else
        {
            if (seeker == null)
            {
                Debug.LogError("Tried to move " + gameObject.name + ", but it does not have pathfinding AI. " +
                               "(Must have Seeker and CustomAIPath components attached.)");
            }
            else
            {
                dlgActionMovement = isDialogueAction;
                if (AnimController != null)
                {
                    AnimController.Walk();
                }
                aiPath.canMove = true;
                seeker.StartPath(transform.position, point);

                InvokeRepeating("PlayFootsteps", 0f, 0.3f);
            }
        }
    }
Example #6
0
 // Use this for initialization
 void Start()
 {
     source = GetComponent <AudioSource>();
     //moveScrpt = GetComponent<MoveScript2>();
     moveScrpt = GetComponent <MoveScript2_2>();
     animC     = GetComponent <AnimController>();
 }
        private void CleanUp()
        {
            AnimController animController = Service.Get <AnimController>();

            if (this.animAlphaIn != null)
            {
                animController.CompleteAnim(this.animAlphaIn);
                this.animAlphaIn = null;
            }
            if (this.animAlphaOut != null)
            {
                animController.CompleteAnim(this.animAlphaOut);
                this.animAlphaOut = null;
            }
            if (this.gameObject != null)
            {
                MeshFilter component = this.gameObject.GetComponent <MeshFilter>();
                component.sharedMesh = null;
            }
            if (this.mesh != null)
            {
                UnityUtils.DestroyMesh(this.mesh);
                this.mesh = null;
            }
            if (this.gameObjectExists)
            {
                this.gameObject.SetActive(false);
                this.gameObjectExists = false;
            }
            this.gameObjectVisible = false;
            this.initialized       = false;
        }
Example #8
0
    void Awake()
    {
        HelicopterBody  = transform.Find("HeilcopterBody").transform;
        EffectPoint     = HelicopterBody.Find("EffectPoint").transform;
        WaterEffect     = transform.Find("WaterEffect").transform;
        DustEffect      = transform.Find("DustEffect").transform;
        BossPoint       = transform.Find("BossLocalPath").transform;
        FirePoint       = HelicopterBody.Find("FirePoint").transform;
        CameraObj       = transform.Find("Main Camera").gameObject;
        PCamera         = CameraObj.GetComponent <Camera>();
        PilotController = HelicopterBody.gameObject.GetOrAddComponent <PilotController>();
        AnimController  = GetComponent <AnimController>();

        BossCameraObj   = transform.Find("BossCamera").gameObject;
        FirstCameraView = transform.Find("FirstView").GetComponent <FirstCameraView>();
        ThirdCameraView = transform.Find("ThirdView").transform;
        ShowUITran      = BossCameraObj.transform.Find("ShowUI").transform;
        BossAttackPoint = BossCameraObj.transform.Find("BossAttackPoint").transform;

        Effect_Shield  = EffectPoint.transform.Find("Effect_Shield").gameObject;
        Effect_Magent  = EffectPoint.transform.Find("Effect_Magent").gameObject;
        EffectSpeedUp  = EffectPoint.transform.Find("Effect_SpeedUp").gameObject;
        Effect_Warning = EffectPoint.transform.Find("Effect_Warning").gameObject;
        EffectFixed    = EffectPoint.transform.Find("Effect_Fixed").gameObject;

        EventDispatcher.AddEventListener <bool>(EventDefine.Event_Trigger_Effect_Water, OnWater);
        EventDispatcher.AddEventListener <bool>(EventDefine.Event_Trigger_Effect_Dust, OnDust);
        EventDispatcher.AddEventListener(EventDefine.Event_Lift_End, OnLiftEnd);
        EventDispatcher.AddEventListener <E_CameraState>(EventDefine.Event_Camera_State_FirstOrThird, ChangeCameraState);
        EventDispatcher.AddEventListener(EventDefine.Event_Player_Gather, UseGather);
        EventDispatcher.AddEventListener <bool>(EventDefine.Event_Gorge_Boss_Animation, OnGorgeBoss);
        EventDispatcher.AddEventListener(EventDefine.Event_Boss_Warning, OnWarning);
        EventDispatcher.AddEventListener(EventDefine.Event_Groge_Boss_Attack, OnGorgeAttack);
    }
 private void Start()
 {
     animController = GetComponent <AnimController>();
     moveController = GetComponent <MovementController>();
     controller     = GetComponent <CharacterController>();
     playerStat     = GetComponent <PlayerStat>();
 }
Example #10
0
 private void ControlConfig(bool playable)
 {
     this.anim       = GetComponent <AnimController>();
     this.input      = GetComponent <InputController>();
     this.ai         = GetComponent <AIController>();
     this.ai.enabled = !playable;
 }
Example #11
0
 // Use this for initialization
 void Start()
 {
     try
     {
         pManager      = FindObjectOfType <PlayerManager>();
         status        = pManager.Status;
         alchemy_ctr   = FindObjectOfType <AlchemyController>();
         alchemyUI_ctr = GameObject.Find("Canvas/Alchemy_UI").GetComponent <AlchemyUIController>();
         BrotherObj    = FindObjectOfType <MoveController>().gameObject;
         move_ctr      = BrotherObj.GetComponent <MoveController>();
         PotObject     = FindObjectOfType <PotController>().gameObject;
         createItemBox = new List <CreateItemStatus.Type>();
         anim_ctr      = BrotherObj.transform.parent.GetComponent <AnimController>();
         lifePoint     = GameObject.FindGameObjectWithTag("LifePoint");
     }
     catch (UnityException e)
     {
         Debug.Log(e + " is NotFound");
     }
     StartHeart();
     setStartSwordList();
     //剣のデバッグ
     //swordList[1] = PlayerStatus.SWORDTYPE.AXE;
     //swordList[2] = PlayerStatus.SWORDTYPE.DARK;
     //swordList[3] = PlayerStatus.SWORDTYPE.VAJURA;
     _itemMax      = false;
     alchemyUIFlag = false;
 }
Example #12
0
 public void SetDestination(Vector3 dest)
 {
     Clenapath();
     AnimController.SetFloat("speed", 0f);
     path     = null;
     pathTask = navAgent.SearchPathAsync(Node.GetTransform.Position, dest);
 }
Example #13
0
    public void StartLevel(Scene scene, LoadSceneMode mode)
    {
        if (scene.name == "Random Map")
        {
            ++level;
            Health.health = 5;
            ResetUI();

            var mapBuilder = GameObject.FindGameObjectWithTag("Map Builder").GetComponent <MapBuilder>();
            mapBuilder.GasStationSpawnDistance = 50 + 15 * level;
            mapBuilder.Seed = UnityEngine.Random.value;

            audiosys.LowerVolume();
            dialogue = GameObject.FindObjectOfType <AnimController>();
            if (level == 0)
            {
                dialogue.Dialogue = GameStartDialogue;
            }
            else
            {
                dialogue.Dialogue = LevelStartDialogue;
            }
            dialogue.OnDialogueEnd = () =>
            {
                pc.Active = true;
                audiosys.BackToNormalVolume();
            };
            dialogue.StartAnim = true;
        }
    }
Example #14
0
        public PlayerPres(IPlayerView view) : base(ENTITY_TYPE.PLAYER)
        {
            _character           = CharacterModel.Create(Type, Id);
            _character.MoveSpeed = 100;

            var collState          = InteractStateModel.Create(Type, Id);
            var interactController = new InteractController(collState.obj);

            _view = view;
            _view.interactController = interactController;
            _character.Position      = _view.Position;
            _view.Subscribe(OnViewChanged);

            _animState      = AnimStateModel.Create(Type, Id);
            _animController = _view.CreateAnimController(_animState.obj);

            AddAnimation(Const.ANIMATION.IDLE, "Standing Idle");
            AddAnimation(Const.ANIMATION.WALK_FW, "Standing Walk Forward");
            AddAnimation(Const.ANIMATION.WALK_BW, "Standing Walk Back");
            AddAnimation(Const.ANIMATION.WALK_LEFT, "Standing Walk Left");
            AddAnimation(Const.ANIMATION.WALK_RIGHT, "Standing Walk Right");
            AddAnimation(Const.ANIMATION.RUN_FW, "Standing Run Forward");
            AddAnimation(Const.ANIMATION.RUN_BW, "Standing Run Back");
            AddAnimation(Const.ANIMATION.RUN_LEFT, "Standing Run Left");
            AddAnimation(Const.ANIMATION.RUN_RIGHT, "Standing Run Right");
            AddAnimation(Const.ANIMATION.ATTACK_FIREBALL_BIG, "Standing 1H Magic Attack 01");
            AddAnimation(Const.ANIMATION.ATTACK_FIREBALL_SMALL, "Standing 2H Magic Attack 01");
            AddAnimation(Const.ANIMATION.ATTACK_SPELL_GROUND, "Standing 2H Cast Spell 01");

            _fsm = new PlayerFSM(this, _animState.obj, _character.obj);
        }
Example #15
0
        public override void Update(float deltaTime, Camera cam)
        {
            if (!item.body.Enabled)
            {
                return;
            }
            if (!picker.HasSelectedItem(item))
            {
                IsActive = false;
            }

            reloadTimer -= deltaTime;
            if (reloadTimer < 0)
            {
                reloadTimer = 0;
            }

            if (!picker.IsKeyDown(InputType.Aim) && !hitting)
            {
                hitPos = 0.0f;
            }

            ApplyStatusEffects(ActionType.OnActive, deltaTime, picker);

            if (item.body.Dir != picker.AnimController.Dir)
            {
                Flip();
            }

            AnimController ac = picker.AnimController;

            //TODO: refactor the hitting logic (get rid of the magic numbers, make it possible to use different kinds of animations for different items)
            if (!hitting)
            {
                bool aim = picker.IsKeyDown(InputType.Aim) && reloadTimer <= 0 && (picker.SelectedConstruction == null || picker.SelectedConstruction.GetComponent <Ladder>() != null);
                if (aim)
                {
                    hitPos = MathUtils.WrapAnglePi(Math.Min(hitPos + deltaTime * 5f, MathHelper.PiOver4));
                    ac.HoldItem(deltaTime, item, handlePos, aimPos, Vector2.Zero, false, hitPos, holdAngle + hitPos);
                }
                else
                {
                    hitPos = 0;
                    ac.HoldItem(deltaTime, item, handlePos, holdPos, Vector2.Zero, false, holdAngle);
                }
            }
            else
            {
                hitPos = MathUtils.WrapAnglePi(hitPos - deltaTime * 15f);
                ac.HoldItem(deltaTime, item, handlePos, new Vector2(2, 0), Vector2.Zero, false, hitPos, holdAngle + hitPos); // aimPos not used -> zero (new Vector2(-0.3f, 0.2f)), holdPos new Vector2(0.6f, -0.1f)
                if (hitPos < -MathHelper.PiOver2)
                {
                    RestoreCollision();
                    hitting = false;
                    hitTargets.Clear();
                    hitPos = 0;
                }
            }
        }
Example #16
0
 private void ControlConfig(bool value)
 {
     this.anim          = GetComponent <AnimController>();
     this.input         = GetComponent <InputController>();
     this.ai            = GetComponent <AIController>();
     this.input.enabled = value;
     this.ai.enabled    = !value;
 }
Example #17
0
 public override void Hide()
 {
     AnimController.ClearQueue();
     AnimController.AddAnim(new UiAnimationFade(gameObject, 0.25f, UiAnimationFade.FadeType.Out));
     AnimController.AddDelay(0.5f);
     AnimController.AddAction("Destroy", () => Destroy(gameObject));
     AnimController.PlayAnimations();
 }
Example #18
0
 // Use this for initialization
 void Start()
 {
     _setTarget = false;
     move_ctr   = gameObject.transform.parent.GetComponentInChildren <MoveController>();
     player_ctr = GameObject.Find("Controller").GetComponent <PlayerController>();
     anim_ctr   = gameObject.transform.parent.GetComponent <AnimController>();
     direction  = move_ctr.direc;
 }
Example #19
0
 public void PlayAnimationAtPosition(AnimationClip clip)
 {
     if (transformVar != null)
     {
         pendingActions++;
         AnimController.PlayAnimAt(clip, GetPos(transformVar), true);
     }
 }
Example #20
0
    private AnimController animController;         // The animation controller

    // Use this for initialization
    void Awake()
    {
        // Assign some vars
        noGravityScript = GetComponent <NoGravityPhysicsStuff> ();
        animController  = GetComponent <AnimController> ();
        rigBody         = GetComponent <Rigidbody> ();
        canGrab         = false;
    }
Example #21
0
        private void InventoryKeyManipulation(string number)
        {
            Item selectedItem = this.inventory.GetItemList().Where(id => id.actionKey == number).FirstOrDefault();

            if (selectedItem != null)
            {
                if (selectedItem.itemType == Item.ItemType.GoldenKey || selectedItem.itemType == Item.ItemType.SilverKey)
                {
                    if (_selection != null)
                    {
                        if (_selection.name == "CurvedDrawer" || _selection.name == "Drawer1" || _selection.name == "Drawer2" || _selection.name == "Drawer3" || _selection.name == "Drawer4")
                        {
                            if (selectedItem.id == 11)
                            {
                                UnlockSound.Play();
                                //_selection.GetComponent<BoxCollider>().enabled = false;
                                this.CurvedDrawerUnLocked = true;
                                SelectableObject selectedObject = GameObject.Find("CurvedDrawer").GetComponent <SelectableObject>();
                                selectedObject.locked = false;
                                Debug.Log("Curved drawer is unlocked.");
                                inventory.RemoveItem(selectedItem);
                                objectManipulation.ShowFloatingText(_selection.name, _selection.tag);
                            }
                            else
                            {
                                StartCoroutine(objectManipulation.ShowWarningText("Wrong Key!"));
                            }
                        }
                        else if (_selection.name == "Door")
                        {
                            if (selectedItem.id == 22)
                            {
                                UnlockSound.Play();
                                this.DoorUnLocked = true;
                                SelectableObject selectedObject = GameObject.Find("Door").GetComponent <SelectableObject>();
                                selectedObject.locked = false;
                                Debug.Log("Door is unlocked.");
                                inventory.RemoveItem(selectedItem);
                                StartCoroutine(objectManipulation.ShowWarningText("Get Out!"));
                                AnimController ac1 = GameObject.Find("WallNorth").GetComponent <AnimController>();
                                ac1.StartDoorAnimation();
                                DoorOpenSound.Play();
                            }
                            else
                            {
                                StartCoroutine(objectManipulation.ShowWarningText("Wrong Key!"));
                            }
                        }
                    }
                }
                else
                {
                    UiInventoryRead.SetActive(true);
                    Transform rawImage = UiInventoryRead.transform.GetChild(0).GetChild(0);
                    rawImage.GetComponent <RawImage>().texture = selectedItem.inventoryImage;
                }
            }
        }
Example #22
0
    /// <summary>
    /// Setup initial alpha values
    /// </summary>
    void Setup()
    {
        // Set initial alpha via hack :^)
        AnimController.AddAnim(new UiAnimationFade(ReadyTitle.gameObject, 0f, UiAnimationFade.FadeType.Out), false);
        AnimController.AddAnim(new UiAnimationFade(ReadyTimer.gameObject, 0f, UiAnimationFade.FadeType.Out), false);
        AnimController.AddAnim(new UiAnimationFade(Top.gameObject, 0f, UiAnimationFade.FadeType.In), false);

        AnimController.PlayAnimations();
    }
Example #23
0
    private void Start()
    {
        rigidBody      = GetComponent <Rigidbody>() as Rigidbody;
        animController = this.gameObject.GetComponent(typeof(AnimController)) as AnimController;

        //Hit everything under layer 8
        layerMask = 1 << 8;
        layerMask = ~layerMask;
    }
Example #24
0
 /// <summary>
 /// Invinsible 시간 종료 시 실행됩니다.
 /// </summary>
 public void Test_OnInvinsibleTimeEnd()
 {
     if (IsInvinsible)
     {
         IsInvinsible = false;
         //피격 레이어 Off.
         AnimController.SetLayerWeight(1, 0f);
     }
 }
Example #25
0
 private void Start()
 {
     currentLevel = GameManager.Instance.GetLevelBarController().GetCurrentLevel();
     SetHealth();
     animController         = GameManager.Instance.GetAnimController();
     scoreAndCoinController = GameManager.Instance.GetScoreAndCoinController();
     uiController           = GameManager.Instance.GetUIController();
     textHealth.text        = health.ToString();
 }
Example #26
0
 private void Start()
 {
     animController = GameManager.Instance.GetAnimController();
     gameCanvases[0].gameObject.SetActive(true);
     gameCanvases[1].gameObject.SetActive(false);
     gameCanvases[2].gameObject.SetActive(false);
     gameCanvases[3].gameObject.SetActive(false);
     gameCanvases[4].gameObject.SetActive(false);
 }
Example #27
0
    // 琚?彫鍞ゅ洖璋僡a
    protected void MonsterSummoned()
    {
        WhenEnterTrigger(gameObject, new int[4] {
            0, 0, 0, 0
        });

        //
        if (NotifySummoned != null)
        {
            NotifySummoned(this);
        }

        //
        renderNode.SetActive(true);                             //< 鎵撳紑娓叉煋鑺傜偣aa

        //
        mMotionController.enabled = true;               //< 鎵撳紑鍔ㄤ綔鎺у埗鍣╝a

        // 閫忔槑搴?a
        mDisappeared  = false;
        mCurrentAlpha = 1.0f;
        SetAlpha(mCurrentAlpha);

        // 璁板綍棣栨?琚?彫鍞ょ殑浣嶇疆鍜屽Э鎬乤a
        if (mIsFirstSummoned)
        {
            mIsFirstSummoned       = false;
            mFirstSummonedPosition = this.gameObject.transform.position;
            mFirstSummonedRotation = this.gameObject.transform.rotation;
        }

        // 鍑虹敓闊虫晥\鐗规晥\鍔ㄧ敾aa
        if (bornValid)
        {
            if (bornAinm != null && bornAinm.Length != 0)
            {
                AnimationState state = AnimController[bornAinm];
                if (state != null)
                {
                    //Debug.Log(gameObject.name + "\n");
                    state.layer = 20;
                    //state.speed = 0.5f;
                    state.wrapMode = WrapMode.Once;
                    AnimController.Play(bornAinm, PlayMode.StopAll);
                }
            }
            if (bornEffect != null && bornEffect.Length != 0)
            {
                attachEffect(bornEffect, "gamelevel", transform.localPosition, transform.localRotation, 1.0f, 5.0f);
            }
            if (bornAudio != null && bornAudio.Length != 0)
            {
                PlayAudio(bornAudio);
            }
        }
    }
Example #28
0
 public void TakeDamage(int damage)
 {
     _curProperty.hp -= damage < 0? 0:damage;
     HpBarUpDate();
     if (_curProperty.hp <= 0)
     {
         AnimController.SetAnim(SoliderAnimState.Dead);
         Destroy(gameObject);
     }
 }
Example #29
0
 // Use this for initialization
 void Start()
 {
     move_ctr     = transform.parent.GetComponentInChildren <MoveController>();
     player_ctr   = GameObject.Find("Controller").GetComponent <PlayerController>();
     PotObj       = GameObject.FindObjectOfType <PotController>().gameObject;
     anim_ctr     = move_ctr.gameObject.transform.parent.GetComponent <AnimController>();
     _onLandding  = false;
     _onFallBlock = false;
     _onMoveCloud = false;
     nowDirec     = move_ctr.direc;
 }
 void Start()
 {
     offset          = transform.position.y + 0.9f; //might need to change according to gravity
     delay           = 1;
     yPos            = transform.position.y;
     originalY       = yPos;
     reachedUp       = false;
     movingUpAndDown = false;
     player          = GameObject.Find("Player");
     playerCtrl      = player.GetComponent <AnimController>();
 }
	void Start()
	{
		_playerAnim = GetComponent<AnimController>();
		_playerMovement = GetComponent<MoveController>();
	}
 void Awake()
 {
     instance = this;
 }