private const float k_GroundedStickingVelocityMultiplier = 3f;    // This is to help the character stick to vertically moving platforms.

    private void Awake()
    {
        m_SpriteRenderer        = GetComponent <SpriteRenderer>();
        m_Animator              = GetComponent <Animator>();
        m_CharacterController2D = GetComponent <CharacterController2D>();
        m_Collider2D            = GetComponent <Collider2D>();

        m_HashDeadEffect      = VFXController.StringToHash(deadEffect);
        m_HashAppearingEffect = VFXController.StringToHash(appearingEffect);
        m_HashDustEffect      = VFXController.StringToHash(dustEffect);

        m_HashFootStepAudioPlayer     = AudioPlayerController.StringToHash(footStepAudioPlayer);
        m_HashHitAudioPlayer          = AudioPlayerController.StringToHash(hitAudioPlayer);
        m_HashDeadAudioPlayer         = AudioPlayerController.StringToHash(deadAudioPlayer);
        m_HashAppearingAudioPlayer    = AudioPlayerController.StringToHash(appearingAudioPlayer);
        m_HashLandAudioPlayer         = AudioPlayerController.StringToHash(landAudioPlayer);
        m_HashStartJumpingAudioPlayer = AudioPlayerController.StringToHash(startJumpingAudioPlayer);

        m_SlashPool = BulletPool.GetObjectPool(slashPrefab, 1);

        m_SpriteRenderer.enabled = false;
        shadow.SetActive(false);

        GameManager.Instance.RegisterPlayer(this);
    }
        public void Awake()
        {
            seamoth         = gameObject.GetComponent <SeaMoth>();
            leftTorpedoSlot = seamoth.torpedoTubeLeft.transform;
            energyMixin     = seamoth.GetComponent <EnergyMixin>();

            var scannerPrefab = Resources.Load <GameObject>("WorldEntities/Tools/Scanner").GetComponent <ScannerTool>();

            //ScannerTool scannerPrefab = CraftData.InstantiateFromPrefab(TechType.Scanner, false).GetComponent<ScannerTool>();
            scanSound     = Instantiate(scannerPrefab.scanSound, gameObject.transform);
            completeSound = Instantiate(scannerPrefab.completeSound, gameObject.transform);
            fxControl     = Instantiate(scannerPrefab.fxControl, gameObject.transform);
            scanBeam      = Instantiate(scannerPrefab.scanBeam, leftTorpedoSlot.transform);

            MeshRenderer[] renderers             = scannerPrefab.GetComponentsInChildren <MeshRenderer>(true);
            Renderer       instantiated_renderer = Instantiate(renderers[0]);

            scanCircuitTex = instantiated_renderer.materials[0].mainTexture;
            scanOrganicTex = instantiated_renderer.materials[2].mainTexture;

            //Destroy(instantiated_renderer);
            //Resources.UnloadAsset(scannerPrefab);

            scanBeam.transform.localScale    = new Vector3(1, 4, 1);
            scanBeam.transform.localRotation = new Quaternion(-0.7683826f, 0.1253118f, 0.0448633f, 0.6259971f);
        }
Esempio n. 3
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
Esempio n. 4
0
    // Use this for initialization
    void Awake()
    {
        DieEffectHash = VFXController.StringToHash("Smoke");
        rigidbody2D   = GetComponent <Rigidbody2D>();
        animator      = GetComponent <Animator>();
        rmx6Moving    = GetComponent <rmx6Moving>();
        oldVelocity   = new Vector2(0, 0);
        die           = false;
        rmx6_BT.OpenBranch(
            BT.If(() => { return(targetInRange); }).OpenBranch(
                BT.Call(() => animator.SetBool("walk", true)),
                BT.WaitForAnimatorState(animator, "rmx6_walking"),
                //BT.Wait(0.3f),
                BT.Call(() => { if (!die)
                                {
                                    rmx6Moving.canWalk = true;
                                }
                        })
                ),
            BT.If(() => { return(!targetInRange); }).OpenBranch(
                BT.Call(() => animator.SetBool("walk", false)),
                BT.Call(() => animator.SetBool("hide", true)),
                BT.WaitForAnimatorState(animator, "rmx6_hiding"),
                //BT.Wait(0.3f),
                BT.Call(() => rmx6Moving.canWalk = false)

                )
            );
    }
Esempio n. 5
0
    private void OnValidate()
    {
        if (_screenFader == null)
        {
            _screenFader = GetComponentInChildren <ScreenFader> ();
        }

        if (_sceneController == null)
        {
            _sceneController = GetComponentInChildren <SceneController> ();
        }

        if (_eventManager == null)
        {
            _eventManager = GetComponentInChildren <EventManager> ();
        }

        if (_vfxController == null)
        {
            _vfxController = GetComponentInChildren <VFXController> ();
        }

        if (_backgroundMusicPlayer == null)
        {
            _backgroundMusicPlayer = GetComponentInChildren <BackgroundMusicPlayer> ();
        }
    }
    public static VFXController CreateDefault()
    {
        VFXController controllerPrefab = Resources.Load <VFXController> ("VFXController");

        instance = Instantiate(controllerPrefab);
        return(instance);
    }
 private void FindVaporBlast()
 {
     _vaporFX = FindObject(gameObject.transform, "MaterialEmitter")?.GetComponent <VFXController>();
     if (_vaporFX != null)
     {
         _vaporFX.emitters[1] = null;
         _vaporFX.gameObject.SetActive(true);
     }
 }
Esempio n. 8
0
 private void Start()
 {
     transform.localScale = new Vector3(startScale, startScale, startScale);
     vfxControllerClass   = FindObjectOfType <VFXController>().GetComponent <VFXController>();
     taskHandlerClass     = FindObjectOfType <TaskHandler>();
     granadeRigidBody     = GetComponent <Rigidbody2D>();
     playerStatsClass     = FindObjectOfType <PlayerStatistics>();
     mainCameraPos        = Camera.main.transform.position;
 }
        public override void Awake()
        {
            muzzle    = ArmServices.main.objectHelper.FindDeepChild(gameObject, "muzzle").transform;
            fxControl = GetComponent <VFXController>();
            bubblesFX = transform.Find("xRepulsionCannon_Bubbles").gameObject;

            shootSound      = ScriptableObject.CreateInstance <FMODAsset>();
            shootSound.name = "repulsiom";
            shootSound.id   = "fire";
            shootSound.path = "event:/tools/gravcannon/fire";
        }
Esempio n. 10
0
        public void Awake()
        {
            rb         = GetComponent <Rigidbody>();
            collision  = GetComponent <Collider>();
            fxControl  = GetComponent <VFXController>();
            fixedJoint = GetComponent <FixedJoint>();

            hitSound      = ScriptableObject.CreateInstance <FMODAsset>();
            hitSound.path = "event:/sub/exo/hook_hit";
            hitSound.name = "hook_hit";
        }
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        VFXController controller = (VFXController)target;

        if (GUILayout.Button("Simulate"))
        {
            controller.RunSimulation();
        }
    }
Esempio n. 12
0
 public void CreateBeginParticle()
 {
     if (beginParticle)
     {
         Debug.LogError("已存在beginParticle");
     }
     if (prefabBeginParticle)
     {
         beginParticle = CreateVFXWithAutoDestory(prefabBeginParticle);
         beginParticle.visualEffect.SetVector3("origin_position", origin);
     }
 }
Esempio n. 13
0
 // Use this for initialization
 void Awake()
 {
     DieEffectHash             = VFXController.StringToHash("Smoke");
     shootTime                 = shootCoolDown;
     contactFilter2D.layerMask = hitLayerMask;
     rayCastPosition           = transform.position;
     bulletPool                = BulletPool.GetObjectPool(Bullet, 10);
     animator        = GetComponent <Animator>();
     shootScript     = Bullet.GetComponent <StartShooting>();
     spriteRenderer  = GetComponent <SpriteRenderer>();
     updateHealthBar = GetComponentInChildren <UpdateHealthBar>();
 }
 /// <summary>
 /// 移除连线特效
 /// </summary>
 private void RemoveLineEffect()
 {
     if (m_LineFxInstance != null)
     {
         VFXController vfxController = m_LineFxInstance.GetEffectObject();
         Animator      animator      = vfxController.GetComponentInChildren <Animator>();
         if (animator)
         {
             animator.SetTrigger("dissolve");
         }
     }
 }
Esempio n. 15
0
 public void Init(Skill skill)
 {
     this.skill = skill;
     if (prefabBeginParticle != null)
     {
         skill.eBegin.AddListener(CreateBeginParticle);
         skill.eEnd.AddListener(() =>
         {
             beginParticle.Stop();
             beginParticle = null;
         });
     }
 }
Esempio n. 16
0
 private static void LoadVFXEffects()
 {
     VFXController[] vFXControllers = Resources.FindObjectsOfTypeAll <VFXController>();
     foreach (VFXController vfxController in vFXControllers)
     {
         switch (vfxController.name.ToLower())
         {
         case "cyclopsexplosionfx":
             CYCLOPS_EXPLOSION_VFX = vfxController;
             break;
         }
     }
 }
Esempio n. 17
0
        public void Awake()
        {
            var exosuitPrefab = Resources.Load <GameObject>("WorldEntities/Tools/Exosuit").GetComponent <Exosuit>();

            var exosuitClawArmGO = (GameObject)GetArmPrefabMethod.Invoke(exosuitPrefab, new object[] { TechType.ExosuitClawArmModule });
            var exosuitClawArm   = exosuitClawArmGO.GetComponent <ExosuitClawArm>();

            animator        = exosuitClawArm.animator;
            hitTerrainSound = exosuitClawArm.hitTerrainSound;
            hitFishSound    = exosuitClawArm.hitFishSound;
            pickupSound     = exosuitClawArm.pickupSound;
            front           = exosuitClawArm.front;
            fxControl       = exosuitClawArm.fxControl;
        }
Esempio n. 18
0
    //protected readonly int m_HashTargetLostPara = Animator.StringToHash("TargetLost");
    //protected readonly int m_HashGroundedPara = Animator.StringToHash("Grounded");



    private void Awake()
    {
        HashMeleeAttackPara = Animator.StringToHash(meleeAttackTransitionName);
        HashShootingPara    = Animator.StringToHash(rangeAttackTransitionName);
        HashPatrollingPara  = Animator.StringToHash(patrollingTransitionName);
        HashRunPara         = Animator.StringToHash(runTransitionName);
        HashDeathPara       = Animator.StringToHash(deathTransitionName);
        HashHitPara         = Animator.StringToHash(hitTransitionName);

        //if (deadEffectName != null)
        {
            hashDeadEffect = VFXController.StringToHash(deadEffectName);
        }
        //if (hitEffectName != null)
        {
            hashHitEffect = VFXController.StringToHash(hitEffectName);
        }
        m_CharacterController2D = GetComponent <SimpleCharacterController2D>();
        m_Collider = GetComponent <Collider2D>();

        m_Animator = GetComponent <Animator>();
        if (m_Animator == null)
        {
            m_Animator = GetComponentInChildren <Animator>();
        }

        m_SpriteRenderer = GetComponent <SpriteRenderer>();
        if (m_SpriteRenderer == null)
        {
            m_SpriteRenderer = GetComponentInChildren <SpriteRenderer>();
        }

        m_OriginalColor = m_SpriteRenderer.color;

        if (projectilePrefab != null)
        {
            m_BulletPool = BulletPool.GetObjectPool(projectilePrefab.gameObject, 8);
        }

        m_SpriteForward = spriteFaceLeft ? Vector2.left : Vector2.right;
        if (m_SpriteRenderer.flipX)
        {
            m_SpriteForward = -m_SpriteForward;
        }

        if (meleeDamager != null)
        {
            EndAttack();
        }
    }
    /// <summary>
    /// 改变隐身特效状态
    /// </summary>
    private void ChangeHideEffectState()
    {
        VFXController vfxController = m_HideFxInstance.GetEffectObject();
        Animator      animator      = vfxController.GetComponentInChildren <Animator>();

        if (animator)
        {
            animator.SetTrigger("Materialized");
        }

        if (m_EnergyBodyFxInstance)
        {
            StopEnergyEffect();
        }
    }
Esempio n. 20
0
        public void ScanForVFXController()
        {
            foreach (Transform child in allChilds)
            {
                if (child.TryGetComponent(out VFXController controller))
                {
                    fxControl = controller;

                    isFXfound = true;

                    print($"PrefabTest: found VFXController: {fxControl.name}");

                    break;
                }
            }
        }
Esempio n. 21
0
 /// <summary>
 /// 收到任何伤害消息时
 /// </summary>
 /// <param name="targetID">目标ID</param>
 private void OnAnyHurt(uint targetID)
 {
     if (m_TargetViewer.EffectArray != null)
     {
         foreach (EffectController effect in m_TargetViewer.EffectArray)
         {
             VFXController effectObject = effect.GetEffectObject();
             if (effectObject)
             {
                 Animator animator = effectObject.GetComponent <Animator>();
                 if (animator)
                 {
                     animator.SetTrigger("hurting");
                 }
             }
         }
     }
 }
Esempio n. 22
0
 public async UniTask CreateProjectileParticle()
 {
     if (prefabProjectileParticle)
     {
         GameObject    go = Instantiate(prefabProjectileParticle);
         VFXController t  = go.AddComponent <VFXController>();
         t.observer = vfXObserver;
         if (instant)
         {
             t.InitInstantProjectile(origin, destination);
         }
         else
         {
             var p = MyUniTaskExtensions.WaitUntilEvent(t.eHit);
             t.InitProjectile(origin, destination, speed);
             await p;
         }
     }
 }
    private const float k_GroundedStickingVelocityMultiplier = 3f;    // This is to help the character stick to vertically moving platforms.

    private void Awake()
    {
        //m_Rigidbody2D = GetComponent<Rigidbody2D>();
        m_SpriteRenderer        = GetComponentInChildren <SpriteRenderer>();
        m_AlessiaGraphics       = m_SpriteRenderer.gameObject.transform;
        m_Animator              = GetComponent <Animator>();
        m_CharacterController2D = GetComponent <CharacterController2D>();
        m_CharacterInput        = GetComponent <CharacterInput>();
        m_Flicker                        = m_SpriteRenderer.gameObject.AddComponent <Flicker>();
        m_SlashContactEffect             = slashContactTransform.GetComponentInChildren <ParticleSystem>();
        m_OffsetFromSlashEffectToAlessia = slashContactTransform.position - transform.position;
        m_Damageable                     = GetComponent <Damageable>();

        m_platformEffector2D = FindObjectOfType <PlatformEffector2D>();

        m_HashSlashHitEffect = VFXController.StringToHash(slashHitEffectName);

        m_MiniCollectableHealthPool = BulletPool.GetObjectPool(miniCollectableHealthPrefab, 5);
    }
 // Use this for initialization
 void Awake()
 {
     //currentExistsTime = 0;
     DieEffectHash = VFXController.StringToHash("Smoke");
     Direction     = Vector2.right;
     shootTime     = shootCoolDown;
     //Shooted = false;
     contactFilter2D.layerMask = hitLayerMask;
     RoBotHandPostion          = RobotHand.GetComponent <Transform>();
     RobotHandShootingScript   = RobotHand.GetComponent <StartShooting>();
     //RoBotHandPostion.position = shootOrigin.position;
     animator                = GetComponent <Animator>();
     robotSpriteRenderer     = GetComponent <SpriteRenderer>();
     robotHandSpriteRenderer = RobotHand.GetComponent <SpriteRenderer>();
     capsuleCollider2D       = GetComponent <CapsuleCollider2D>();
     rigidbody2D             = GetComponent <Rigidbody2D>();
     movingInRange           = GetComponent <MovingInRange>();
     Offset = new Vector2(capsuleCollider2D.size.x, 0);
 }
Esempio n. 25
0
    // Use this for initialization
    void Awake()
    {
        m_HashHitEffect  = VFXController.StringToHash(hitEffect);
        m_HashDeadEffect = VFXController.StringToHash(deadEffect);

        m_Animator = GetComponent <Animator>();

        m_BulletPool = BulletPool.GetObjectPool(bullet, 2);


        m_AI.OpenBranch(
            BT.Call(() => m_ShootingTimer = fireTime),
            BT.Call(() => m_Animator.SetBool(m_HashAttackPara, true)),
            BT.WaitUntil(() => m_ShootingTimer <= 0),
            BT.Call(() => m_Animator.SetBool(m_HashAttackPara, false)),
            BT.WaitForAnimatorState(m_Animator, "ExoticPlant_Idle"),
            BT.Wait(timeBetweenShooting)
            );
    }
Esempio n. 26
0
        /// <summary>
        /// 直接回收特效
        /// 会立即停止当前特效的播放, 并把特效回收,放入池子中。
        /// 调用这个方法后,外部对于特效的引用(EffectController)将不再可用。所以这个方法调用后需要将特效的引用赋空
        /// </summary>
        public void RecycleFX()
        {
            if (m_DestroyedUnsafe)
            {
                return;
            }

            if (m_Status == EffectStatus.Recycled)
            {
                return;
            }

            if (m_AssetLoadHandler != null && m_VFXController == null)
            {
                AssetUtil.UnloadAssetLoader(m_AssetLoadHandler);
            }

            StopFX(true);

            OnEffectFinished?.Invoke(this);
            OnEffectFinished = delegate(EffectController e)
            {
            };

            ClearTimer();
            m_Status = EffectStatus.Recycled;

            // 暂时使用老的缓存池。 等李玉斌移植完毕
            //effect.GetEffectObject()?.ReleaseItem();
            if (m_VFXController != null)
            {
                m_VFXController.RecycleFX();
                m_VFXController.transform.SetParent(null, false);
                m_VFXController.Recycle();
                m_VFXController = null;
            }
            else
            {
                DebugUtility.LogFormat("EffectBug", "null VFXController. name: ", GetVFXAssetName());
            }

            ReleaseItem();
        }
Esempio n. 27
0
        public void copyAttackLastTarget(AttackLastTarget a)
        {
            aggressionThreshold = a.aggressionThreshold;

            swimVelocity = a.swimVelocity;

            swimInterval = a.swimInterval;

            minAttackDuration = a.minAttackDuration;

            maxAttackDuration = a.maxAttackDuration;

            pauseInterval = a.pauseInterval;

            resetAggressionOnTime = a.resetAggressionOnTime;

            attackStartSound = a.attackStartSound;

            attackStartFXcontrol = a.attackStartFXcontrol;
        }
Esempio n. 28
0
 void Start()
 {
     foreach (Transform child in transform)
     {
         foreach (Transform particles in child)
         {
             playerParticles.Add(particles.gameObject);
             playerParticlesInitialScale.Add(particles.localScale);
         }
     }
     numParticles       = playerParticles.Count;
     moveSpeed          = 0.1f * runSpeed;
     playerRigidBody    = GetComponent <Rigidbody2D>();
     taskHandlerClass   = FindObjectOfType <TaskHandler>();
     playerState        = PlayerState.Still;
     vfxControllerClass = FindObjectOfType <VFXController>();
     if (levelController != null)
     {
         levelControllerClass = levelController.GetComponent <LevelController>();
     }
     playerStats = FindObjectOfType <PlayerStatistics>();
 }
    /// <summary>
    /// 调整描边特效颜色
    /// </summary>
    private void AdjustOutlineEffectColor()
    {
        if (m_Property != null && m_Property.GetHeroType() == KHeroType.htMine)
        {
            if (m_OutlineVFX != null)
            {
                VFXController effectObject = m_OutlineVFX.GetEffectObject();
                if (effectObject)
                {
                    Animator animator = effectObject.GetComponent <Animator>();
                    if (animator)
                    {
                        float hp    = (float)m_Property.GetOwner().GetAttribute(AttributeName.kHP);
                        float hpMax = (float)m_Property.GetOwner().GetAttribute(AttributeName.kHPMax);

                        float hpProgress = hpMax <= 0 ? 0 : hp / hpMax;

                        animator.SetFloat("Color", 0);
                    }
                }
            }
        }
    }
    private void Awake()
    {
        m_Ai.OpenBranch(
            BT.Sequence().OpenBranch(
                BT.Wait(2f),
                BT.Call(SetNewPosition),
                BT.Wait(1f),
                BT.Call(MoveToNewPosition),
                BT.Wait(1.5f),
                BT.Call(SetAttackPlayer),
                BT.Wait(1f),
                BT.WaitUntil(AttackPlayer),
                BT.Wait(0.5f),
                BT.Call(() => m_Rigidbody2D.velocity = Vector2.zero)
                )
            );

        m_Rigidbody2D            = GetComponent <Rigidbody2D>();
        m_Animator               = GetComponent <Animator>();
        m_SpriteRenderer         = GetComponent <SpriteRenderer>();
        m_SpriteRenderer.enabled = false;
        glowCircle.enabled       = false;
        m_HashDeadEffect         = VFXController.StringToHash(deadEffect);
    }