Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (ps == PortalState.OnePort)
        {
            /*if (Input.GetAxis("Vertical") != 0 || Input.GetAxis("Horizontal") != 0)
             * {
             *  posList.Add(player.transform.position);
             * }*/
            posList.Add(player.transform.position);
        }
        else if (ps == PortalState.DestroyTimerSet)
        {
            currDestroyTimer = 0;
            ps = PortalState.BothPorts;
        }

        if (currDestroyTimer >= aliveTime && currDestroyTimer != -10)
        {
            canDestroyPortal = true;
            currDestroyTimer = -10;
        }
        else if (currDestroyTimer >= 0 && currDestroyTimer != -10)
        {
            currDestroyTimer += Time.deltaTime;
        }

        if (canDestroyPortal && inUse == 0)
        {
            port1.GetComponent <Portaling>().enabled = false;
            port2.GetComponent <Portaling>().enabled = false;

            GameObject.FindObjectOfType <PortalLimiter>().RemovePortal(this, 0.8f);
            canDestroyPortal = false;
        }
    }
Example #2
0
        } // доп. эффект открытия портала

        public Quit(Rectangle rect, Level level)
        {
            this.state = PortalState.Closed;
            this.G     = 0;
            this.level = level;
            this.rect  = rect;
        }  // установка портала
    private IEnumerator ClosePortalCoroutine()
    {
        float completion = 0.0f;

        m_state = PortalState.Closing;

        Vector3 origPos = m_transform.position;

        //  Shrink the portal down
        while (m_state == PortalState.Closing)
        {
            completion            += Time.deltaTime;
            m_transform.localScale = Vector3.Lerp(m_transform.localScale, Vector3.zero, completion);
            m_transform.position   = Vector3.Lerp(origPos, origPos + Vector3.up, completion);

            if (completion >= 1.0f)
            {
                m_state = PortalState.Closed;
            }

            yield return(new WaitForEndOfFrame());
        }

        //  Destroy the portal
        GameObject.Destroy(gameObject);
        yield return(null);
    }
Example #4
0
    public void SetPortState(int n)
    {
        switch (n)
        {
        case 0:
        {
            ps = PortalState.Unspawned;
            break;
        }

        case 1:
        {
            ps = PortalState.OnePort;
            break;
        }

        case 2:
        {
            ps = PortalState.DestroyTimerSet;
            break;
        }

        case 3:
        {
            ps = PortalState.BothPorts;
            break;
        }

        default:
        {
            break;
        }
        }
    }
 public void Update()
 {
     if (!hidden)
     {
         rotation -= 0.2f;
         if (state == PortalState.Smaller)
         {
             if (size > 0.007)
             {
                 size -= 0.003f;
             }
             else
             {
                 state = PortalState.Spinning;
                 hidden = true;
             }
         }
         if (state == PortalState.Bigger)
         {
             if (size < 0.7)
             {
                 size += 0.003f;
                 hitbox = new Rectangle((int)(_position.X - _portaltxt.Width / 2f * size), (int)(_position.Y - _portaltxt.Height / 2f * size), (int)(_portaltxt.Width * size), (int)(_portaltxt.Height * size));
             }
             else
             {
                 state = PortalState.Spinning;
             }
         }
     }
 }
Example #6
0
 //constructer method create a portal
 public Portals(char symbol, ConsoleColor color, Position position,
                PortalState orientation)
 {
     this.symbol      = symbol;
     this.color       = color;
     portalPosition   = position;
     this.orientation = orientation;
 }
Example #7
0
        public void Close(int portalNumber)
        {
            Sprite chosenOne = portalNumber == 1 ? Portal2 : Portal1;
            chosenOne.Angle = 0;

            chosenOne.Visible = false;
            mState = PortalState.Closed;
        }
Example #8
0
 public void Close(int portalNumber)
 {
     Sprite chosenOne = portalNumber == 1 ? Portal2 : Portal1;
     chosenOne.Angle = 0;
     chosenOne.Position = new Vector2(-50, -50);
     chosenOne.Visible = false;
     chosenOne.Scale = 1f;
     mState = PortalState.Closed;
 }
Example #9
0
 public void SetProtalState(PortalState portalState)
 {
     m_PortalState = portalState;
     if (portalState == PortalState.CountDown)
     {
         m_CurTime = 0;
     }
     FreshEffectState();
 }
Example #10
0
	void OnTriggerExit2D()
	{
		//Debug.LogWarning("exit " + inPortal + "  " );
		//if (state == PortalState.Transfer)
		state = PortalState.Open;
//		{
//			Debug.LogWarning("exit");
//
//		}
	}
Example #11
0
        /// <summary>
        /// Updates the portal state to the new state and fires an event to all listeners informing them of the state change
        /// </summary>
        private void UpdatePortalState(PortalState newState)
        {
            PortalState oldState = _portalState;

            _portalState = newState;
            if (PortalStateChanged != null)
            {
                PortalStateChanged(this, new PortalStateChangedEventArgs
                                       (oldState, newState));
            }
        }
Example #12
0
    /// При вхождении в коллайдер портала игрока - переключить анимацию
    /// и загрузить новый уровень
    private void OnTriggerEnter2D(Collider2D collider)
    {
        Character character = collider.GetComponent <Character>();

        if (character)
        {
            Destroy(character);
            State = PortalState.BringPlayer;
            SceneManager.LoadScene(nameOfLevel);
        }
    }
Example #13
0
 // Update is called once per frame
 void Update()
 {
     if (state == PortalState.PS_Locked && lockTime + Time.deltaTime > LockingTime)
     {
         state = PortalState.PS_Unlocked;
         this.GetComponent <SpriteRenderer>().sprite = TwoStatesSprite[1];
     }
     else
     {
         lockTime += Time.deltaTime;
     }
 }
        public override void OnAdd()
        {
            // This will blow up an entity it's attached to
            base.OnAdd();

            _state = PortalState.Pending;

            if (_aliveTime > 0)
            {
                Timer.Spawn(TimeSpan.FromSeconds(_aliveTime), () => Owner.Delete());
            }
        }
        public void TryChangeState(PortalState targetState)
        {
            if (Owner == null)
            {
                return;
            }

            _state = targetState;
            if (_appearanceComponent != null)
            {
                _appearanceComponent.SetData(PortalVisuals.State, _state);
            }
        }
Example #16
0
	void OnTriggerEnter2D()
	{
		//Debug.LogWarning("enter " + inPortal + "  " );
		if (state == PortalState.Open )
		{
//			Debug.LogWarning("enter");
			state = PortalState.Close;
			m_Linked.state = PortalState.Transfer;

			GameValue.Ball.Trail.enabled = false;
			GameValue.Ball.EnterPortal(m_Linked.m_Trans.position);
		}
	}
Example #17
0
 public void PortalClose()
 {
     if (currentState == PortalState.Spawning)
     {
         this.gameObject.SetActive(false);
         currentState = PortalState.Exiting;
     }
     else
     {
         SceneTransitionManager.Instance.TransitionToScene(SceneUtility.GetScenePathByBuildIndex(SceneManager.GetActiveScene().buildIndex + 1),
                                                           SceneTransitionManager.AnimationType.forward);
     }
 }
Example #18
0
        public static void ReportStatus(PortalState status, ByteArray byteArray)
        {
            byteArray.Reset();
            byteArray.WriteHeader();

            byteArray.writeInt(EnumPortalReportMethods.CLIENT_REPORTSTATUS_HASH);
            byteArray.EncryptKey = EnumPortalReportMethods.CLIENT_REPORTSTATUS_HASH;
            byteArray.CRC        = 0;
            byteArray.writeDynamicsInt(ByteArray.globalSeq);
            status.WriteToByteArray(byteArray);
            ++ByteArray.globalSeq;
            byteArray.writeIntNCRC(byteArray.CRC);
            byteArray.EncryptKey = 0;
        }
        public void TryChangeState(PortalState targetState)
        {
            if (Deleted)
            {
                return;
            }

            _state = targetState;

            if (Owner.TryGetComponent(out AppearanceComponent? appearance))
            {
                appearance.SetData(PortalVisuals.State, _state);
            }
        }
        public override void OnAdd()
        {
            // This will blow up an entity it's attached to
            base.OnAdd();
            if (Owner.TryGetComponent <CollidableComponent>(out var collide))
            {
                //collide.IsHardCollidable = false;
            }

            _state = PortalState.Pending;
            if (_aliveTime > 0)
            {
                Timer.Spawn(TimeSpan.FromSeconds(_aliveTime), () => Owner.Delete());
            }
        }
Example #21
0
        public static ByteArray ReportStatus(PortalState status)
        {
            ByteArray byteArray = new ByteArray();

            byteArray.writeInt(EnumPortalReportMethods.CLIENT_REPORTSTATUS_HASH);
            byteArray.EncryptKey = EnumPortalReportMethods.CLIENT_REPORTSTATUS_HASH;
            byteArray.CRC        = 0;
            byteArray.writeDynamicsInt(ByteArray.globalSeq);
            status.WriteToByteArray(byteArray);

            ++ByteArray.globalSeq;
            byteArray.writeInt(byteArray.CRC);
            byteArray.EncryptKey = 0;
            return(byteArray);
        }
Example #22
0
        private static bool OnReportStatus(ByteArray byteArray, IPortalReportClientService clientService)
        {
            PortalState status = new PortalState();

            status.ReadFromByteArray(byteArray);

            int crc = byteArray.readIntNCRC();

            if (crc == byteArray.CRC)
            {
                clientService.OnReportStatus(ref status);
            }

            byteArray.Recycle();
            return(true);
        }
Example #23
0
        public override void Update(GameTime gameTime)
        {
            switch (state)
            {
            case PortalState.Opened:
                if (rect.Intersects(level.hero.rect))
                {
                    int distance = rect.X + rect.Width / 2 - level.hero.rect.X - level.hero.rect.Width / 2;
                    if (distance == 0 && rect.Bottom - level.hero.rect.Bottom - 1 == 100)
                    {
                        level.Game.Components.Add(new Completed(level.Game, level));
                        this.state = PortalState.Entrance;
                    }
                }
                additive = (float)random.Next(51) / 100;
                G        = 1 - additive;
                break;

            case PortalState.Prepared:
                if (R > 0)
                {
                    float K = (float)gameTime.ElapsedGameTime.Ticks / 40000000;
                    R -= K;
                    G += K;
                    EngineSpark(500 * K);
                }
                else
                {
                    state = PortalState.Opened;
                    R     = 0;
                }
                break;

            case PortalState.Closed:
                additive = (float)random.Next(51) / 100;
                R        = 1 - additive;
                break;

            case PortalState.Entrance:
                additive = (float)random.Next(51) / 100;
                G        = 1 - additive;
                break;
            }
            dy += (float)gameTime.ElapsedGameTime.Ticks / 3000000;
            base.Update(gameTime);
            EngineRocket(new Vector2(rect.X + rect.Width / 2, rect.Y));
        }
Example #24
0
        private static string ParseReportStatus(ByteArray byteArray)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("ReportStatus(");

            sb.Append("status : PortalState");

            sb.Append(")\r\n{\r\n");
            int         crc    = byteArray.readIntNCRC(); // parse global seq
            PortalState status = new PortalState();

            status.ReadFromByteArray(byteArray);
            sb.AppendFormat(@"status = ""{0}""", status);
            sb.Append("}");
            return(sb.ToString());
        }
    private AudioSource m_windSource;           //  The audio source for the wind sound


    //  Set up the portal
    private void InitPortal(FloatHolder knifeFloat)
    {
        //  Get various objects
        m_transform       = GetComponent <Transform>();
        m_renderer        = GetComponent <Renderer>();
        m_player          = GameObject.Find("Player").GetComponent <PlayerController>();
        m_effectSource    = gameObject.AddComponent <AudioSource>();
        m_dimensionSource = gameObject.AddComponent <AudioSource>();
        m_windSource      = gameObject.AddComponent <AudioSource>();
        m_knifeFloat      = knifeFloat;
        startScale        = m_transform.localScale;
        endScale          = new Vector3(30f, 30f, 1f);
        m_state           = PortalState.Opening;

        //  The portal is all set up
        initialised = true;
    }
Example #26
0
    void Start()
    {
        //カメラを使うので用意する
        camera = GameObject.FindGameObjectWithTag("PlayCamera");
        //Debug.Log("カメラだぜ" + camera);
        //Shader用のテクスチャを入れる
        material.SetTexture("_SubTex", text);
        //プロパティの初期化
        portalPos  = new Vector3(.0f, .0f, .0f);
        PortalFlag = false;
        //時間関係の設定
        portalTime = 4;

        //状態を初期化
        portalState = PortalState.FirstSpread;

        flag = true;
        //portalState = PortalState.SubNone;
    }
Example #27
0
	void Start()
	{
		state = PortalState.Open;

		if (listPortals == null)
		{
			listPortals = GameObject.FindGameObjectsWithTag("portal");
		}
		

		for (int i = 0; i < listPortals.Length; i++)
		{
			if (listPortals[i].GetInstanceID() != gameObject.GetInstanceID())
			{
				m_Linked = listPortals[i].GetComponent<Portal>();
				break;
			}
		}
	}
Example #28
0
    void OpenPoral()
    {
        /*-------------------------------------
        *  DOTween.To
        *   (
        *   () => Number,      //何に
        *   (n) => Number = n, //何を
        *   100,               //どこまで(最終的な値)
        *   10.0f               //どれくらいの時間
        *   );
        *        -------------------------------------*/
        //Debug.Log("状態:" + portalState);

        switch (portalState)
        {
        case PortalState.FirstSpread:
            DOTween.KillAll();
            DOTween.To(() => currentPortalRadius, SetPortalRadius, radius / 5, 1.5f).SetEase(Ease.OutBack);
            portalState = PortalState.None;
            break;

        case PortalState.Shrink:
            DOTween.KillAll();
            DOTween.To(() => radius / 5, SetPortalRadius, radius / 10, 1.0f).SetEase(Ease.InBack);
            portalState = PortalState.SubNone;
            break;

        case PortalState.SecondSpread:
            DOTween.KillAll();
            DOTween.To(() => currentPortalRadius, SetPortalRadius, radius, 3.0f).SetEase(Ease.OutBack);
            portalState = PortalState.LastNone;
            break;
        }
        if (portalTime < 2.5f && portalState == PortalState.None)
        {
            portalState = PortalState.Shrink;
        }
        if (portalState == PortalState.SubNone && portalTime < 1.5f)
        {
            portalState = PortalState.SecondSpread;
        }
    }
    private IEnumerator OpenPortalCoroutine()
    {
        float completion = 0.0f;

        //  Update the shader with the knife animation value
        while (m_state == PortalState.Opening)
        {
            completion = Mathf.Clamp01(m_knifeFloat.value);
            m_renderer.material.SetFloat("_Completion", completion);
            if (completion >= 1.0f)
            {
                m_state = PortalState.Open;
            }
            yield return(new WaitForEndOfFrame());
        }

        m_player.isCreatingPortal = false;

        yield return(null);
    }
        public bool WaitUntil(int timeout, IfDelegate ifDelegate)
        {
            RestartTimer();
            bool startFormVisible = Form != null && Form.Visible;

            while (ElapsedMs < timeout)
            {
                if (ifDelegate())
                {
                    return(true);
                }
                bool actualVisible = Form != null && Form.Visible;
                if (startFormVisible != actualVisible)
                {
                    State = PortalState.ClosedUnexpectedly;
                    return(false);
                }
                Thread.Sleep(50);
                Application.DoEvents();
            }
            AddError("Operation timeout.");
            return(false);
        }
Example #31
0
 //rotate the portals door
 public Portals PortalRotation()
 {
     if (orientation == PortalState.North)
     {
         orientation = PortalState.East;
         symbol      = '\u2191';
     }
     else if (orientation == PortalState.South)
     {
         orientation = PortalState.West;
         symbol      = '\u2190';
     }
     else if (orientation == PortalState.West)
     {
         orientation = PortalState.North;
         symbol      = '\u2192';
     }
     else if (orientation == PortalState.East)
     {
         orientation = PortalState.South;
         symbol      = '\u2193';
     }
     return(this);
 }
Example #32
0
    void SetPortalState(PortalState s)
    {
        if (s != _curPortalState)
        {
            PortalState prevState = _curPortalState;

            _curPortalState = s;

            if (s == PortalState.NoProgress)
            {
                ShowPortal(false); //just in case
                TeleportToWorld(Nights2Mgr.Instance.RoomWorld, Nights2Mgr.WorldID.RoomWorld);
            }
            else if (s == PortalState.ShowingEntrancePortal)
            {
                _waitTillBehindPortal = true;
                Nights2Path curPath = Nights2Mgr.Instance.CurrentTorchPath();
                Debug.Assert(curPath != null);

                Vector3 portalPos = curPath.GetPortalPos(Nights2Path.PortalType.EntrancePortal);
                Vector3 portalDir = curPath.GetPortalDir(Nights2Path.PortalType.EntrancePortal);

                //ping from entrance portal spot when its revealed
                if (Nights2SpotMgr.Instance != null)
                   Nights2SpotMgr.Instance.TriggerSpotFX(Nights2SpotMgr.LightAction.Ping, 1.5f, curPath.GetPortalSpot(Nights2Path.PortalType.EntrancePortal), .5f);

                //put dest trans in the alt world, so camera is positioned correctly on portal
                Transform destTrans = (_portalFX != null) ? _portalFX.PortalDestTrans : null;
                if (destTrans != null)
                {
                    destTrans.position = PortalDestOffset + portalPos + Nights2Mgr.Instance.RoomWorld.transform.position + (Nights2Mgr.Instance.CurAltWorld().transform.position - Nights2Mgr.Instance.RoomWorld.transform.position);
                    destTrans.rotation = Quaternion.LookRotation(portalDir);
                }

                PositionPortal(portalPos);
                AlignPortal(portalDir);

                ShowPortal(true);
            }
            else if (s == PortalState.ShowingExitPortal)
            {
                _waitTillBehindPortal = true;
                Nights2Path curPath = Nights2Mgr.Instance.CurrentTorchPath();
                Debug.Assert(curPath != null);

                Vector3 portalPos = curPath.GetPortalPos(Nights2Path.PortalType.ExitPortal);
                Vector3 portalDir = curPath.GetPortalDir(Nights2Path.PortalType.ExitPortal);

                //ping from exit portal spot when its revealed
                if (Nights2SpotMgr.Instance != null)
                   Nights2SpotMgr.Instance.TriggerSpotFX(Nights2SpotMgr.LightAction.Ping, 1.5f, curPath.GetPortalSpot(Nights2Path.PortalType.ExitPortal), .5f);

                //put dest trans in the alt world, so camera is positioned correctly on portal
                Transform destTrans = (_portalFX != null) ? _portalFX.PortalDestTrans : null;
                if (destTrans != null)
                {
                    destTrans.position = PortalDestOffset + portalPos + (Nights2Mgr.Instance.RoomWorld.transform.position - Nights2Mgr.Instance.CurAltWorld().transform.position);
                    destTrans.rotation = Quaternion.LookRotation(portalDir);
                }

                PositionPortal(portalPos);
                AlignPortal(portalDir);

                ShowPortal(true);
            }
            else if ((s == PortalState.ThroughEntrancePortal) || (s == PortalState.ThroughExitPortal))
            {
                ShowPortal(false, true);

                if (s == PortalState.ThroughEntrancePortal)
                {
                    TeleportToWorld(Nights2Mgr.Instance.CurAltWorld(), Nights2Mgr.Instance.CurAltWorldID());
                }
                else
                {
                    TeleportToWorld( Nights2Mgr.Instance.RoomWorld, Nights2Mgr.WorldID.RoomWorld);
                }
            }

            if (OnPortalStateChanged != null)
                OnPortalStateChanged(this, new PortalChangedEventArgs(prevState, _curPortalState));
        }
    }
Example #33
0
 public void CheatPortalState(PortalState s)
 {
     SetPortalState(s);
 }
Example #34
0
 public void Lock()
 {
     portalState = PortalState.LOCKED;
     visualEffect.SetActive(false);
 }
Example #35
0
 public void Unlock()
 {
     portalState = PortalState.UNLOCKED;
     visualEffect.SetActive(true);
 }
Example #36
0
 internal PortalStateChangedEventArgs(PortalState previousState, PortalState newState)
 {
     _previousState = previousState;
     _newState      = newState;
 }
Example #37
0
        }  // установка портала

        public void OpenPortal()
        {
            state = PortalState.Prepared;
            R     = 1;
        } // открытие портала после сбора
Example #38
0
        public void Open(Vector2 position, Orientation orientation, int portalNumber, Vector2 movement, Level lvl, object targetObject)
        {
            Sprite chosenOne = mPortals[portalNumber];

            try
            {
                mPortalHolders[portalNumber] = targetObject;
                chosenOne.Visible = true;
                chosenOne.Angle = (int)orientation % 2== 0 ? MathHelper.PiOver2 : 0;
                chosenOne.Position = position;
                chosenOne.Oriented = orientation;
                chosenOne.FrameVelocity = movement;

                int count = 0;

                foreach (Tile t in lvl.Tiles)
                    if (!Rectangle.Intersect(chosenOne.CollisionSurface, t.Dimensions).IsEmpty)
                        ++count;

                if (count > 1)
                    throw new Exception("Invalid Portal Location");
            }
            catch
            {
                mPortalHolders[portalNumber] = null;
                chosenOne.Visible = false;
                return;
            }

            if (Portal1.Visible == Portal2.Visible)
            {
                if (!Rectangle.Intersect(Portal1.CollisionSurface, Portal2.CollisionSurface).IsEmpty)
                {
                    Close(1 - portalNumber);
                    return;
                }
                mState = PortalState.Open;
                lvl.PlaySoundEffect(mOpenPortalEffect);
            }
            lvl.LevelStatistics.PortalsOpened++;
        }
Example #39
0
 public void AddSprite(int portalNumber, Actor spr)
 {
     (portalNumber == 0 ? mInPortal1 : mInPortal2).Add(spr);
     mState = PortalState.InUse;
 }
Example #40
0
        public void Update(GameTime theGameTime)
        {
            if (mInPortal1.Count + mInPortal2.Count > 0)
                mState = PortalState.InUse;
            else if(mState == PortalState.InUse)
                mState = PortalState.Open;

            Portal1.Update(theGameTime);
            Portal2.Update(theGameTime);

            foreach (Actor spr in mInPortal1)
            {
                HandleSpriteInPortal(spr, Portal1, Portal2, (float)theGameTime.TotalGameTime.TotalSeconds);
            }

            foreach (Actor spr in mInPortal2)
            {
                HandleSpriteInPortal(spr, Portal2, Portal1, (float)theGameTime.TotalGameTime.TotalSeconds);
            }
        }
Example #41
0
 public void Reset()
 {
     Portal1.Reset();
     Portal2.Reset();
     mState = PortalState.Closed;
     mInPortal1.Clear();
     mInPortal2.Clear();
     Portal1.Visible = Portal2.Visible = false;
 }
Example #42
0
        public void Open(Vector2 position, Orientation orientation, int portalNumber, Vector2 movement, Level lvl)
        {
            Sprite chosenOne = portalNumber == 1 ? Portal2 : Portal1;

            chosenOne.Visible = true;
            chosenOne.Angle = (int)orientation % 2== 0 ? MathHelper.PiOver2 : 0;
            chosenOne.Position = position;
            chosenOne.Oriented = orientation;
            chosenOne.FrameVelocity = movement;

            if (Portal1.Visible == Portal2.Visible)
            {
                if (!Rectangle.Intersect(Portal1.CollisionSurface, Portal2.CollisionSurface).IsEmpty)
                {
                    Close(portalNumber);
                    return;
                }
                mState = PortalState.Open;
                lvl.PlaySoundEffect(mOpenPortalEffect);
            }
            lvl.LevelStatistics.PortalsOpened++;
        }
Example #43
0
 public PortalChangedEventArgs(PortalState oldState, PortalState newState)
 {
     OldState = oldState; NewState = newState;
 }
Example #44
0
    public void Start()
    {
        _gameHandler = GameObject.FindWithTag("GameHandler");
        gameHandler  = _gameHandler.GetComponent <GameHandler>();

        _portalState = GameObject.FindWithTag("PortalHandler");
        portalState  = _portalState.GetComponent <PortalState>();

        persistentSFXGameObject = GameObject.Find("PersistentSFX");
        persistentSFX           = persistentSFXGameObject.GetComponent <PersistentSFX>();

        DOTween.Init();

        levelManager = GameObject.Find("LevelManager");

        fadeInTweenContainer = GameObject.FindWithTag("FadeInTweener");
        fadeInTweener        = fadeInTweenContainer.GetComponent <DOTweenVisualManager>();

        fadeOutTweenContainer = GameObject.FindWithTag("FadeOutTweener");
        fadeOutTweener        = fadeOutTweenContainer.GetComponent <DOTweenVisualManager>();

        hostileBrain = this.GetComponentInChildren <HostileBrain>();

        //healthMax = 100;

        containerHealth     = 20;
        enemyHealth         = 50;
        playerHealth        = 100;
        critterHealth       = 10;
        foliageHealth       = 15;
        frogBossHealth      = 100;
        chaosVillagerHealth = 30;

        respawnPos = new Vector3(0, 0, 0);

        if (this.tag == "Player")
        {
            health = playerHealth;

            //anim = gameObject.GetComponent<Animator>();
            anim = gameObject.GetComponentInChildren <Animator>();
            if (anim == null)
            {
                //anim = gameObject.GetComponentInChildren<Animator>();
                Debug.Log("Error: Did not find anim!");
            }
            else
            {
                //Debug.Log("Got anim");
            }
        }

        if (this.tag == "Foliage")
        {
            health = foliageHealth;
        }

        if (this.tag == "Enemy")
        {
            health = enemyHealth;

            anim = gameObject.GetComponent <Animator>();
            if (anim == null)
            {
                Debug.Log("Error: Did not find anim!");
            }
            else
            {
                //Debug.Log("Got anim");
            }
        }

        if (this.tag == "Container")
        {
            health = containerHealth;
        }

        if (this.tag == "Critter")
        {
            health = critterHealth;

            anim = gameObject.GetComponent <Animator>();
            if (anim == null)
            {
                Debug.Log("Error: Did not find anim!");
            }
            else
            {
                //Debug.Log("Got anim");
            }
        }

        if (this.tag == "FrogBoss")
        {
            health = frogBossHealth;

            animContainer = GameObject.Find("chaosFrog");
            anim          = animContainer.GetComponent <Animator>();

            if (anim == null)
            {
                Debug.Log("Error: Did not find anim!");
            }
            else
            {
                //Debug.Log("Got anim");
            }
        }

        if (this.tag == "ChaosVillager")
        {
            health = chaosVillagerHealth;

            anim = this.GetComponentInChildren <Animator>();

            if (anim == null)
            {
                Debug.Log("Error: Did not find anim!");
            }
            else
            {
                //Debug.Log("Got anim");
            }
        }
    }
Example #45
0
 public void Close(int portalNumber)
 {
     mPortalHolders[portalNumber] = null;
     Sprite chosenOne = mPortals[portalNumber];
     chosenOne.Angle = 0;
     chosenOne.Position = new Vector2(-50, -50);
     chosenOne.Visible = false;
     chosenOne.Scale = 1f;
     mState = PortalState.Closed;
 }