コード例 #1
0
ファイル: BaseWeapon.cs プロジェクト: calebsmth54/Dun-Djinn
            public WeaponFSM(string name, BaseWeapon weapon) : base(name, weapon)
            {
                if (!weapon)
                {
                    // TODO: Add log
                    LogHalt("BaseWeapon object null!");
                    Halt();
                }

                idleState     = new IdleState(this, EWeaponState.IDLE, "STATE_IDLE", weapon);
                windupState   = new WindupState(this, EWeaponState.WINDUP, "STATE_WINDUP", weapon);
                fireState     = new FireState(this, EWeaponState.FIRING, "STATE_FIRING", weapon);
                cooldownState = new CooldownState(this, EWeaponState.COOLDOWN, "STATE_COOLDOWN", weapon);

                idleState.AddTransition(new Tran_IdleToWindup(windupState, weapon));

                windupState.AddTransition(new Tran_WindupToIdle(idleState, weapon));
                windupState.AddTransition(new Tran_WindupToFire(fireState, weapon));

                fireState.AddTransition(new Tran_FireToCooldown(cooldownState, weapon));
                fireState.AddTransition(new Tran_FireToIdle(idleState, weapon));
                fireState.AddTransition(new Tran_FireToFire(fireState, weapon));

                AddState(idleState);
                AddState(windupState);
                AddState(fireState);
                AddState(cooldownState);
            }
コード例 #2
0
 //Initilizes trap
 public override void Init()
 {
     base.Init();
     _currDetectDistance = 0;
     _startDelay         = Time.time;
     _mystate            = FireState.BEGINBURNING;
 }
コード例 #3
0
ファイル: Tank.cs プロジェクト: wkim564/ManVsMagnitude
 public void ToFireMode()
 {
     base.MoveTo(gameObject.transform.position);
     mFireState          = FireState.CANFIRE;
     rend.material.color = Color.red;
     Debug.Log("canfire");
 }
コード例 #4
0
    void Start()
    {
        enemies  = new List <Enemy>(); // not sure
        spawners = new List <Spawner>(FindObjectsOfType <Spawner>());

        process = new ProcessState();
        spawn   = new SpawnState(spawners);
        arrange = new ArrangeState(FindObjectOfType <GridManager>());
        fire    = new FireState();

        if (null == processButton)
        {
            Debug.Log("no process button");
        }
        else
        {
            process.AddReadyButton(processButton);
        }

        process.nextState = spawn;
        spawn.nextState   = arrange;
        arrange.nextState = fire;
        fire.nextState    = process;

        currentState = process;
    }
コード例 #5
0
    //stops fire animation
    //receeds raycasts with fire animation
    void StopFire()
    {
        _currDelay = (Time.time - _startDelay) / _fireIncDuration;

        _currDetectDistance = _maxDetectDistance * (1 - _currDelay);

        LookForPlayer();

        if (_currDelay >= 1)
        {
            _currDelay = 1;

            _currDetectDistance = 0;

            _startDelay = Time.time;

            if (bossEntity.GetComponent <TrapBossGlhost>())
            {
                bossEntity.GetComponent <TrapBossGlhost>().IsNotPossessing = true;
            }
            else if (bossEntity.GetComponent <MiniTrapBossGlhost>())
            {
                bossEntity.GetComponent <MiniTrapBossGlhost>().IsPossessing = true;
            }

            _mystate = FireState.FLAMEBURNOUT;
        }
    }
コード例 #6
0
    private void ChangeState(int futureState)
    {
        if (futureState >= 0)
        {
            currentState.effect.Stop();

            currentState = states[futureState];

            Debug.Log(currentState.displayName);
            Debug.Log(currentState.displayColor);

            currentState.effect.Play();
            BURN_TIER      = currentState.burnTier;
            fireText.text  = currentState.displayName;
            fireText.color = currentState.displayColor;
        }

        /*
         * particles[state].Stop();
         * particles[futureState].Play();
         * if(futureState == 3)
         * {
         *  WeatherScript.NIGHT_ENABLED = true;
         * }
         * state++;
         */
    }
コード例 #7
0
    private void CheckFireReload()
    {
        switch (m_FireState)
        {
        case FireState.Ready:
            if (true == Input.GetKey(KeyCode.Space))
            {
                m_FireState = FireState.Fire;
            }
            break;

        case FireState.Fire:
            FireBullet();
            m_FireState = FireState.Reload;
            m_FireTime  = Time.timeSinceLevelLoad;
            break;

        case FireState.Reload:
            if (Time.timeSinceLevelLoad - m_FireTime > m_ReloadTime)
            {
                m_FireState = FireState.Ready;
            }
            break;
        }
    }
コード例 #8
0
 void Update()
 {
     if (_grid != null)
     {
         foreach (var cell in _grid.gridCells)
         {
             if (_burningCells.Contains(cell.Value))
             {
                 if (cell.Value.state == FireState.Normal && cell.Value.HasReachedBurningTemperature())
                 {
                     _flames.Add(cell.Value.position,
                                 Instantiate(firePrefab, cell.Value.position, Quaternion.identity, transform));
                     _burningCells.AddRange(GetCellNeighbours(cell.Value));
                     _state = FireState.OnFire;
                     _heatSource.enabled = true;
                     break;
                 }
                 else if (!cell.Value.IsStillBurning(Time.deltaTime))
                 {
                     Destroy(_flames[cell.Key]);
                     _flames.Remove(cell.Key);
                     _burningCells.Remove(cell.Value);
                 }
             }
         }
     }
     if (_burningCells.Count == 0 && _state == FireState.OnFire)
     {
         _heatSource.enabled = false;
         _state = FireState.BurntDown;
     }
 }
コード例 #9
0
ファイル: BaseBoomerang.cs プロジェクト: zuhane/BallSmasher
 public virtual void Release(Vector3 attackDirectionVector, float charge)
 {
     AudioManager.PlaySound(attackReleaseSound);
     fireState    = FireState.Live;
     charge       = Mathf.Clamp(charge, 1, chargeLimit);
     velocity     = attackDirectionVector * velocityModifier * charge;
     enabledTimer = Timer.CreateComponent(gameObject, enabledTime);
 }
コード例 #10
0
ファイル: FireEnemy.cs プロジェクト: MatthewDulworth/GGJ2020
 // -------------------------------------------------
 // MonoBehaviour
 // -------------------------------------------------
 public override void Start()
 {
     base.Start();
     invincible       = true;
     fireballs        = new List <AttackController>();
     fireState        = FireState.descending;
     this.floatHeight = this.transform.position.y + this.floatHeight;
 }
コード例 #11
0
ファイル: Tank.cs プロジェクト: wkim564/ManVsMagnitude
 // Use this for initialization
 void Start()
 {
     base.Start();
     mFireState = FireState.MOVING;
     rend       = GetComponent <Renderer>();
     cannonRend = cannon.GetComponent <Renderer>();
     CommanderUnitControl mCommander = (CommanderUnitControl)GameObject.FindObjectOfType <CommanderUnitControl>();
 }
コード例 #12
0
 private void enqueueFires(int count, float health)
 {
     for (int i = 0; i != count; ++i)
     {
         FireState fs = new FireState(health);
         remainingFires.Enqueue(fs);
     }
 }
コード例 #13
0
 public void ThrowWeapon()
 {
     skeletonAnimation.state.ClearTrack(3);
     skeletonAnimation.state.SetAnimation(4, "throw", false);
     skeletonAnimation.state.End += ThrowAnimationCompleteHandler;
     skeletonAnimation.state.Event += OnWeaponThrown;
     fireState = FireState.THROW;
 }
コード例 #14
0
 void Start()
 {
     _state              = FireState.Normal;
     _heatSource         = GetComponent <HeatSource>();
     _heatSource.enabled = false;
     _meshRenderer       = GetComponent <Renderer>();
     _burningCells       = new List <FireCell>();
 }
コード例 #15
0
        public void FireTransition(Peach peach)
        {
            sound = peach.Content.Load <SoundEffect>("Sound Effects/Power Up");
            sound.Play();
            var state = new FireState(this);

            peach.PowerUpState = state;
            peach.SwitchToFireSprite();
        }
コード例 #16
0
 //starts delay to spit out fire
 void StartingDelay()
 {
     _currDelay = (Time.time - _startDelay) / _beginningDelay;
     if (_currDelay >= 1)
     {
         _currDelay  = 1;
         _startDelay = Time.time;
         _mystate    = FireState.SMOKEON;
     }
 }
コード例 #17
0
 public void UpdateFireState(bool status)
 {
     if (status)
     {
         fireState = FireState.Ready;
     }
     else
     {
         fireState = FireState.NotReady;
     }
 }
コード例 #18
0
ファイル: Tile.cs プロジェクト: benmcmorran/incendia
 public Tile(float flammability, int material,
             string texture1, string texture2, string texture3,
             FireState state, bool solid, bool outside, bool explodes)
 {
     Flammability = flammability;
     Material     = material;
     State        = state;
     _solid       = solid;
     Outside      = outside;
     EXPLODES     = explodes;
 }
コード例 #19
0
ファイル: Edifice.cs プロジェクト: felipe0703/RoleTeamGame
        void SetFireState(FireState newFireState)
        {
            //TODO: cambiar el color de los sprite cuando se comience a quemar

            if (newFireState == FireState.level0)
            {
                //CallStartFireNeighbor();
                level1.SetActive(false);
                level2.SetActive(false);
                level3.SetActive(false);
                level4.SetActive(false);
                contFire = 0;
            }

            if (newFireState == FireState.level1)
            {
                //CallStartFireNeighbor();
                level1.SetActive(true);
                level2.SetActive(false);
                level3.SetActive(false);
                level4.SetActive(false);
                contFire = 1;
            }

            if (newFireState == FireState.level2)
            {
                level1.SetActive(false);
                level2.SetActive(true);
                level3.SetActive(false);
                level4.SetActive(false);
                contFire = 2;
                //CallFireLevel2();
            }

            if (newFireState == FireState.level3)
            {
                contFire = 3;
                level1.SetActive(false);
                level2.SetActive(false);
                level3.SetActive(true);
                level4.SetActive(false);
                //CallFireLevel3();
            }

            if (newFireState == FireState.level4)
            {
                contFire = 4;
                level1.SetActive(false);
                level2.SetActive(false);
                level3.SetActive(false);
                level4.SetActive(true);
                //CallFireLevel4();
            }
        }
コード例 #20
0
ファイル: FireBlast.cs プロジェクト: mattfaenza/Illicio
 void FireOff()
 {
     Scale(0.0f);
     if (markTime + offTime < Time.time)
     {
         state                  = FireState.READY;
         rend.enabled           = false;
         col_detect.enabled     = true;
         scaleTarget.localScale = Vector3.one;
         target.SendMessage("Activate");
     }
 }
コード例 #21
0
ファイル: FireBlast.cs プロジェクト: mattfaenza/Illicio
 void FireOn()
 {
     Scale(1.0f);
     if (markTime + onTime < Time.time)
     {
         state              = FireState.OFF;
         markTime           = Time.time;
         rend.enabled       = true;
         col_detect.enabled = false;
         target.SendMessage("Deactivate");
     }
 }
コード例 #22
0
    //plays fire animation after a delay
    void StartSmoke()
    {
        _currDelay = (Time.time - _startDelay) / _fireDelay;

        if (_currDelay >= 1)
        {
            _currDelay = 1;
            _mySmoke.Play();
            _startDelay = Time.time;
            _mystate    = FireState.FLAMEDELAY;
        }
    }
コード例 #23
0
 //plays fire animation after a delay
 void StartFire()
 {
     _currDelay = (Time.time - _startDelay) / _fireDelay;
     if (_currDelay >= 1)
     {
         _currDelay = 1;
         _mySmoke.Stop();
         _myFire.Play();
         _startDelay = Time.time;
         _mystate    = FireState.FLAMEON;
     }
 }
コード例 #24
0
    private void SpawnFires()
    {
        int numFires    = findFires().Count;
        int numToCreate = Mathf.Min(MaxActiveFires - numFires, remainingFires.Count);

        for (int i = 0; i != numToCreate; ++i)
        {
            Vector3    spawnPos = new Vector3(Random.Range(-3.25f, 3.25f), Random.Range(1.3f, 1.8f), 0.0f);
            GameObject newFire  = Instantiate(fire, spawnPos, Quaternion.identity, gameObject.transform);
            FireState  fs       = remainingFires.Dequeue();
            newFire.GetComponent <FireController>().State = fs;
        }
    }
コード例 #25
0
ファイル: FireEnemy.cs プロジェクト: MatthewDulworth/GGJ2020
    // -------------------------------------------------
    // Active
    // -------------------------------------------------
    protected override void Active()
    {
        if (this.fireState == FireState.floating)
        {
            CheckFlips();

            if (Mathf.Abs(this.transform.position.x - target.transform.position.x) <= this.range)
            {
                this.rb.velocity = Vector2.zero;
                if (rangedCoolDown <= 0)
                {
                    rangedCoolDown = rangedCoolDownMax;
                    FireAttack();
                }
            }
            else
            {
                this.rb.velocity = Vector2.right * this.walkSpeed * -TargetDirection();
            }

            if (this.transform.position.y > this.floatHeight)
            {
                ascend();
            }
        }

        else if (this.fireState == FireState.ascending)
        {
            if (this.transform.position.y >= this.floatHeight)
            {
                this.rb.velocity = Vector2.zero;
                this.fireState   = FireState.floating;
            }

            int modifier = 1;
            if (this.transform.position.y > this.floatHeight)
            {
                modifier = -1;
            }
            rb.velocity = Vector2.up * ascendVelocity * modifier;
        }

        else if (this.fireState == FireState.descending)
        {
            if (grounded)
            {
                StartCoroutine(LandStun());
                this.fireState = FireState.landStun;
            }
        }
    }
コード例 #26
0
 public bool HasReachedBurningTemperature()
 {
     if (state == FireState.OnFire)
     {
         return(false);
     }
     _currentTemperature += settings.temperatureChangePerFrame;
     if (_currentTemperature >= settings.initialBurningTemperature)
     {
         state = FireState.OnFire;
         return(true);
     }
     return(false);
 }
コード例 #27
0
ファイル: FireBlast.cs プロジェクト: mattfaenza/Illicio
 public void OnTriggerEnter(Collider coll)
 {
     if (state == FireState.READY)
     {
         if (coll.gameObject.tag == "Player" || coll.gameObject.tag == "Hologram" || coll.gameObject.tag == "Enemy")
         {
             state    = FireState.ON;
             markTime = Time.time;
             scaleTarget.localScale = Vector3.zero;
             rend.enabled           = true;
             col_detect.enabled     = true;
         }
     }
 }
コード例 #28
0
    //plays fire animation after a delay
    void StartFire()
    {
        _currDelay = (Time.time - _startDelay) / _fireDelay;

        if (_currDelay >= 1)
        {
            _currDelay = 1;

            _myFire.Play();
            _startDelay = Time.time;
            Debug.Log("Shoot Fire");
            _mystate = FireState.FLAMEON;
        }
    }
コード例 #29
0
 public bool IsStillBurning(float timeElapsed)
 {
     if (state == FireState.BurntDown || state == FireState.Normal)
     {
         return(true);
     }
     _burningTime += timeElapsed;
     if (_burningTime >= settings.burningTime)
     {
         state = FireState.BurntDown;
         return(false);
     }
     return(true);
 }
コード例 #30
0
 public void CopyInformation(CellAlchemyState copy)
 {
     gasState      = copy.gasState;
     liquidState   = copy.liquidState;
     solidState    = copy.solidState;
     blessingState = copy.blessingState;
     fireState     = copy.fireState;
     shockState    = copy.shockState;
     changedValues.Clear();
     foreach (AlchemyChangeType change in copy.changedValues)
     {
         changedValues.Add(change);
     }
 }
コード例 #31
0
ファイル: UnitBase.cs プロジェクト: rykerrr/black-navy
    protected bool FireWeapons()
    {
        foreach (WeaponBase wep in weapons)
        {
            FireState ret = wep.Fire();

            if (ret == FireState.OutOfAmmo)
            {
                ReloadWeapons();
                return(false);
            }
        }

        return(true);
    }
コード例 #32
0
	private void CheckFireReload()
	{
		switch( m_FireState )
		{
		case FireState.Ready :
			m_FireState = FireState.Fire ;
			break ;
			
		case FireState.Fire :
			FireBullet() ;
			m_FireState = FireState.Reload ;
			m_FireTime = Time.timeSinceLevelLoad ;
			break ;
			
		case FireState.Reload :
			if( Time.timeSinceLevelLoad - m_FireTime > 
									m_ReloadTime )
				m_FireState = FireState.Ready ;
			break ;			
		}				
	}
コード例 #33
0
	private void CheckFireReload()
	{
		switch( m_FireState )
		{
		case FireState.Ready :
			if( true == Input.GetKey( KeyCode.Space ) )
			{
				m_FireState = FireState.Fire ;
			}			
			break ;
			
		case FireState.Fire :
			FireBullet() ;
			m_FireState = FireState.Reload ;
			m_FireTime = Time.timeSinceLevelLoad ;
			break ;
			
		case FireState.Reload :
			if( Time.timeSinceLevelLoad - m_FireTime > m_ReloadTime )
				m_FireState = FireState.Ready ;
			break ;			
		}				
	}
コード例 #34
0
    public void FireHoming()
    {
        if (fireState == FireState.Waiting)
        {
            if (counter > waitDuration)
            {
                fireState = FireState.Firing;
                counter -= waitDuration;
            }
        }
        else if (fireState == FireState.Firing)
        {
            GameObject bullet = (GameObject)Instantiate(homingProjectile, new Vector3(transform.position.x, transform.position.y + 1.0f, transform.position.z), new Quaternion());

            bullet.GetComponent<EvilToken>().difficulty = difficulty;

            Destroy(bullet, homingLifeTime);

            fireState = FireState.Waiting;
            reloadCount = 0;
            counter = 0;
            PickNextGunType();
        }
    }
コード例 #35
0
    void FixedUpdate( )
    {
        if ( !m_RobotComponent.bCanMove || !GameManager.Instance.m_MatchStarted )
        {
            m_NavAgent.Stop( );
            return;
        }
        else
        {
            m_NavAgent.Resume( );
        }

        if ( m_NavAgent.velocity != Vector3.zero ) m_CurrentLocomotionState = LocomotionState.MOVING;
        else m_CurrentLocomotionState = LocomotionState.IDLE;

        //Handle moving
        switch ( m_CurrentLocomotionState )
        {
            case LocomotionState.IDLE:

                Vector3 _targetLoc = GetRandomLocationNearPlayer();
                if ( _targetLoc != Vector3.zero )
                {
                    m_NavAgent.SetDestination( _targetLoc );
                    return;
                }

                if ( Vector3.Distance( transform.position, _targetLagLocation ) < 6 )
                {
                    transform.LookAt( _targetLagLocation, Vector3.up );
                }

                break;

            case LocomotionState.MOVING:
                _targetLagLocation = Vector3.Lerp( _targetLagLocation, m_PlayerCurrentLocation, 0.03f );
                transform.LookAt( _targetLagLocation, Vector3.up );

                if ( Vector3.Distance( transform.position, _targetLagLocation ) < 3 )
                {
                    m_NavAgent.Stop( );
                }
                else
                {
                    m_CurrentLocomotionState = LocomotionState.IDLE;
                }
                break;
        }

        //Handle firing
        switch ( m_CurrentFireState )
        {
		case FireState.AIMING:

			if (Vector3.Distance (m_PlayerCurrentLocation, transform.position) < 3) {
				if (!m_IsFiringLeftWeapon) {
					FireLeftWeapon ();
				}

				if (!m_IsFiringRightWeapon) {
					FireRightWeapon ();
				}
			} else
				m_CurrentFireState = FireState.AIMING;
                break;

            case FireState.FIRING:

                break;
        }
    }
コード例 #36
0
    void FireRightWeapon( )
    {
		m_CurrentFireState = FireState.FIRING;
        m_IsFiringRightWeapon = true;
        m_RobotComponent.RightWeaponFire( );
    }
コード例 #37
0
 private void StartThrow()
 {
     fireState = FireState.START_THROW;
     skeletonAnimation.state.SetAnimation(2, "throw_start",false);
     skeletonAnimation.state.End += SartThrowCompleteHandler;
 }
コード例 #38
0
 void ThrowAnimationCompleteHandler(Spine.AnimationState state, int trackIndex)
 {
     if (trackIndex != 4)
         return;
     skeletonAnimation.state.End -= ThrowAnimationCompleteHandler;
     this.fireState = FireState.IDLE;
 }
コード例 #39
0
 void OnMainStateStateChanged(PlayerController.State state)
 {
     if (state == PlayerController.State.Hurt)
         fireState = FireState.IDLE;
 }
コード例 #40
0
 private void SartThrowCompleteHandler(Spine.AnimationState state, int trackIndex)
 {
     if (trackIndex != 2)
         return;
     skeletonAnimation.state.End -= SartThrowCompleteHandler;
     skeletonAnimation.state.SetAnimation(3, "throw_boost", true);
     this.fireState = FireState.BOOST_THROW;
     boostStarTime = TimerManager.Instance.CurrentTime;
 }
コード例 #41
0
    public void FireLaser()
    {
        if (fireState == FireState.Waiting)
        {
            if (counter > waitDuration)
            {
                fireState = FireState.Firing;
                counter -= waitDuration;
            }
        }
        else if (fireState == FireState.Firing)
        {
            if (reloadCount < laserFireCount)
            {
                if (counter > laserFireRate)
                {
                    counter -= laserFireRate;
                    GameObject bullet = (GameObject)Instantiate(laserProjectile, new Vector3(transform.position.x, transform.position.y + 1.0f, transform.position.z), new Quaternion());

                    bullet.GetComponent<EvilToken>().difficulty = difficulty;

                    bullet.GetComponent<Rigidbody>().AddForce(dirToPlayer * laserVelocity * bullet.GetComponent<Rigidbody>().mass);

                    reloadCount++;

                    Destroy(bullet, laserBulletLifeTime);
                }
            }
            else
            {
                fireState = FireState.Waiting;
                reloadCount = 0;
                PickNextGunType();
            }
        }
    }
コード例 #42
0
    //Mose of these methods are fairly similar. Most do velocity setting and difficulty scaling. They fire at different rates and create diffferent projectiles.
    //The homing projectile auto-homes so we just need to set and forget it.
    public void FireShotgun()
    {
        if (fireState == FireState.Waiting)
        {
            if (counter > waitDuration)
            {
                fireState = FireState.Firing;
                counter -= waitDuration;
            }
        }
        else if (fireState == FireState.Firing)
        {
            for (int i = 0; i < buckCount; i++)
            {
                Vector3 randV = new Vector3(1.0f * Random.Range(-scatterAmount, scatterAmount), 1.0f * Random.Range(-scatterAmount, scatterAmount), 1.0f * Random.Range(-scatterAmount, scatterAmount)) ;
                GameObject bullet = (GameObject)Instantiate(shotgunProjectile, new Vector3(transform.position.x, transform.position.y + 1.0f, transform.position.z), new Quaternion());

                bullet.GetComponent<EvilToken>().difficulty = difficulty;

                bullet.GetComponent<Rigidbody>().AddForce((dirToPlayer + randV) * buckVelocity * bullet.GetComponent<Rigidbody>().mass);

                Destroy(bullet, buckLifeTime);
            }

            fireState = FireState.Waiting;
            counter = 0;
            PickNextGunType();
            reloadCount = 0;
        }
    }
コード例 #43
0
 public BoostState(Tutorial context, ChainedState _back)
     : base(context)
 {
     back = _back;
     next = new FireState(context, this);
 }