Beispiel #1
0
 void Start()
 {
     hook = GetComponentInChildren<GrapplingHook>();
     animator = GetComponent<Animator>();
     spawnEffect = gameObject.GetComponentInChildren<SpawnEffect>();
     //doubleJumpParticle = GameObject.Find ("doubleJump").GetComponent<DoubleJumpParticle> ();
     spawn = transform.position;
 }
Beispiel #2
0
 void Start()
 {
     hook        = GetComponentInChildren <GrapplingHook>();
     animator    = GetComponent <Animator>();
     spawnEffect = gameObject.GetComponentInChildren <SpawnEffect>();
     //doubleJumpParticle = GameObject.Find ("doubleJump").GetComponent<DoubleJumpParticle> ();
     spawn = transform.position;
 }
Beispiel #3
0
        private void DoDissolveEffect(SpawnEffect spawnEffect)
        {
            Renderer renderer = gameObject.GetComponent <Renderer> ();

            renderer.material        = gameManager.DissolveMaterial;
            renderer.material.shader = gameManager.DissolveShader;

            spawnEffect.enabled = true;
        }
 // Start is called before the first frame update
 private void Awake()
 {
     if (Instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         Instance = this;
     }
 }
Beispiel #5
0
        private void Die()
        {
            if (health <= 0 && !alreadyDied)
            {
                alreadyDied = true;

                SpawnEffect spawnEffect = gameObject.GetComponent <SpawnEffect> ();
                DoDissolveEffect(spawnEffect);

                Destroy(gameObject, spawnEffect.spawnEffectTime);
                gameManager.TotalEnemies--;
                gameManager.TryToChangeMemoryUse(-memoryBackAmmount, false);
            }
        }
Beispiel #6
0
    IEnumerator ApplySpawn(Entity e)
    {
        yield return(new WaitForFixedUpdate());

        //get available spawn fx
        if (mCurSpawnInd == mSpawnEffects.Length)
        {
            for (int i = 0; i < mSpawnEffects.Length; i++)
            {
                if (!mSpawnEffects[i].gameObject.active)
                {
                    mCurSpawnInd = i;
                    break;
                }
            }

            if (mCurSpawnInd == mSpawnEffects.Length)
            {
                Debug.LogWarning("No more spawn effects...");
                yield break;
            }
        }

        SpawnEffect fx = mSpawnEffects[mCurSpawnInd];

        mCurSpawnInd++;

        Vector3 entPos = e.transform.position;

        fx.transform.position = new Vector3(entPos.x, entPos.y, fx.transform.position.z);

        fx.gameObject.SetActiveRecursively(true);

        //base scale on radius
        if (e.planetAttach == null)
        {
            fx.Begin(1.0f, OnSpawnEnd);
        }
        else
        {
            Bounds b = fx.sprite.GetBounds();
            float  s = (e.planetAttach.radius * 2.0f + fx.sizeOffset) / (b.size.y > b.size.x ? b.size.y : b.size.x);
            fx.Begin(s, OnSpawnEnd);
        }

        yield break;
    }
Beispiel #7
0
        /// <summary>
        /// Broadcasts spawn effect (Effect, Spawn) in range of sendFrom.
        /// </summary>
        /// <param name="spawnEffect"></param>
        /// <param name="regionId"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="sender"></param>
        /// <param name="sendFrom">Falls back to sender if null</param>
        public static void SpawnEffect(SpawnEffect spawnEffect, int regionId, int x, int y, Creature sender, Creature sendFrom = null)
        {
            if (sendFrom == null)
            {
                sendFrom = sender;
            }

            var packet = new Packet(Op.Effect, sender.EntityId);

            packet.PutInt(E.Spawn);
            packet.PutInt(regionId);
            packet.PutFloat((float)x);
            packet.PutFloat((float)y);
            packet.PutByte((byte)spawnEffect);

            sender.Region.Broadcast(packet, sendFrom);
        }
Beispiel #8
0
    private void Start()
    {
        MaxHP     = HP;
        _actPos   = transform.position;
        _actScale = transform.localScale;
        if (Level.Instance != null)
        {
            Level.Instance.InitPos(this);
        }
        HpMat = GetComponent <SpriteRenderer>().material;
        HpMat.SetFloat("_Rot", Random.Range(-1f, 1f));
        HpMat.SetFloat("_Center", Random.Range(0.35f, 0.55f));
        HpMat.SetInt("_Hp", HP);
        HpMat.SetInt("_CurHp", HP);

        SpawnEffect.Create(transform.position, this);
    }
Beispiel #9
0
    // Start is called before the first frame update
    void Start()
    {
        isHit          = false;
        animator       = transform.GetChild(0).gameObject.GetComponent <Animator>();
        chMv           = GetComponent <ChickenMovement>();
        groundSpawner  = GameObject.FindObjectOfType <GroundSpawner>();
        strengthEffect = transform.GetChild(1).gameObject.GetComponent <SpawnEffect>();


        createTargetPatternStrength();
        // createTargetPatternJump();

        // Access chicken's body color
        chk_rendererBD = chickenBody.GetComponent <SkinnedMeshRenderer>();
        chk_rendererWG = chickenWings.GetComponent <SkinnedMeshRenderer>();
        chk_rendererTH = chickenThigs.GetComponent <SkinnedMeshRenderer>();
        originalColor  = chk_rendererBD.material.color;
    }
Beispiel #10
0
        public override void GetOffFromUfo(Vector3 position, Terrain terrain)
        {
            _currentTerrain = terrain;
            IsDead          = false;
            Health          = StartHealth;
            InUfo           = false;
            MovingToUfo     = false;

            transform.position = position;
            gameObject.SetActive(true);
            SetState(AlienStates.IdleLookAround);
            StartCoroutine(CheckPlayerDistance());

            if (SpawnEffect != null)
            {
                SpawnEffect.SetActive(true);
            }

            StartCoroutine(CheckCurrentTerrain());
        }
Beispiel #11
0
 public static MabiPacket SpawnEffect(MabiEntity entity, SpawnEffect type, MabiVertex pos)
 {
     return
         new MabiPacket(Op.Effect, entity.Id)
         .PutInt(Effect.Spawn)
         .PutInt(entity.Region)
         .PutFloats(pos.X, pos.Y)
         .PutByte((byte)type);
 }
Beispiel #12
0
 public static MabiPacket SpawnEffect(MabiEntity entity, SpawnEffect type)
 {
     return SpawnEffect(entity, type, entity.GetPosition());
 }
Beispiel #13
0
 private void OnSpawnEnd(SpawnEffect fx)
 {
     fx.gameObject.SetActiveRecursively(false);
 }
Beispiel #14
0
        /// <summary>
        /// Broadcasts spawn effect (Effect, Spawn) in range of sendFrom.
        /// </summary>
        /// <param name="spawnEffect"></param>
        /// <param name="regionId"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="sender"></param>
        /// <param name="sendFrom">Falls back to sender if null</param>
        public static void SpawnEffect(SpawnEffect spawnEffect, int regionId, int x, int y, Creature sender, Creature sendFrom = null)
        {
            if (sendFrom == null)
                sendFrom = sender;

            var packet = new Packet(Op.Effect, sender.EntityId);
            packet.PutInt(E.Spawn);
            packet.PutInt(regionId);
            packet.PutFloat((float)x);
            packet.PutFloat((float)y);
            packet.PutByte((byte)spawnEffect);

            sender.Region.Broadcast(packet, sendFrom);
        }
Beispiel #15
0
 private void OnSpawnEnd(SpawnEffect fx)
 {
     fx.gameObject.SetActiveRecursively(false);
 }
Beispiel #16
0
 // Start is called before the first frame update
 void Start()
 {
     mySpawn = GetComponent <SpawnEffect>();
 }