/// <summary>
 /// Constructor
 /// </summary>
 /// <param Name="actor">Equipped actor</param>
 public WindowEquipLeft(GameActor actor)
     : base(0, 64, 272, 192)
 {
     this.Contents = new Bitmap(Width - 32, Height - 32);
     this.actor = actor;
     Refresh();
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param Name="actor">Displayed actor</param>
 public WindowStatus(GameActor actor)
     : base(0, 0, GeexEdit.GameWindowWidth, GeexEdit.GameWindowHeight)
 {
     this.Contents = new Bitmap(Width - 32, Height - 32);
     this.actor = actor;
     Refresh();
 }
 public bool CanSeeInStraight( GameActor actor, int row, int column )
 {
     Vector3 actor_map_pos = actor.map_pos;
     int actor_column = (int)( actor_map_pos.x );
     int actor_row = (int)( actor_map_pos.y );
     return row == actor_row || column == actor_column;
 }
 public bool CanSeeInDiagonal( GameActor actor, int row, int column )
 {
     Vector3 actor_map_pos = actor.map_pos;
     int actor_column = (int)( actor_map_pos.x );
     int actor_row = (int)( actor_map_pos.y );
     return ( Mathf.Abs ( actor_column - column ) == Mathf.Abs ( actor_row - row ) );
 }
 public int CalculateDistance( GameActor actor, int row, int column )
 {
     int cur_map_x = (int)actor.map_pos.x;
     int cur_map_y = (int)actor.map_pos.y;
     int diff_map_x = Mathf.Abs ( cur_map_x - column );
     int diff_map_y = Mathf.Abs ( cur_map_y - row );
     return diff_map_x + diff_map_y;
 }
Exemple #6
0
 /// <summary>
 /// Initialize
 /// </summary>
 public override void LoadSceneContent()
 {
     // Get actor
     actor = InGame.Actors[InGame.Temp.NameActorId];
     // Make windows
     editWindow = new WindowNameEdit(actor, InGame.Temp.NameMaxChar);
     inputWindow = new WindowNameInput();
 }
		/// <summary>
		/// Initialize
		/// </summary>
		/// <param Name="actor_index">actor index</param>
		/// <param Name="equip_index">equip index</param>
		void SetUp(int actor_index, int equip_index)
		{
			this.actorIndex = actor_index;
			// Get actor
			actor = InGame.Party.Actors[actor_index];
			// Make status window
			statusWindow = new WindowStatus(actor);
		}
Exemple #8
0
        /// <summary>
        /// Test to see if a beam hit anything, object or terrain.
        /// </summary>
        /// <param name="shooter"></param>
        /// <param name="beams"></param>
        /// <param name="particle"></param>
        /// <returns></returns>
        private bool HitSomething(GameActor shooter, Beam beam)
        {
            Vector3 start = beam.Position;
            Vector3 end   = start + beam.Velocity * Time.GameTimeFrameSeconds;

            Vector3 terrainHit = end;
            bool    hitTerrain = beam.Life - beam.TTL >= beam.TTTerraHit;

            if (hitTerrain)
            {
                /// terrain hit is current position
                /// - what we've travelled already (vel * (life - ttl))
                /// + time from beginning to terrain hit (vel * ttTerraHit)
                /// We use end as current position because we've already updated TTL
                /// but haven't yet advanced .Position. When we do advance .Position,
                /// it will be to "end".
                terrainHit = end + beam.Velocity * (beam.TTTerraHit - (beam.Life - beam.TTL));
            }

            Vector3   hitPoint = terrainHit;
            GameActor hitThing = beam.TargetActor;

            if (hitThing != null)
            {
                // never hit terrain if we have a valid target actor
                hitTerrain = false;
                hitPoint   = beam.TargetActor.WorldCollisionCenter;
            }

            // used the actor to determine if we've hit the target
            Vector3 beamVector = end - hitPoint;
            float   beamLength = beamVector.LengthSquared();
            bool    hitTarget  = beamLength < 0.25f;

            if (hitTerrain && hitTarget)
            {
                float beamToTerrain = Vector3.DistanceSquared(start, terrainHit);
                float beamToHit     = Vector3.DistanceSquared(start, hitPoint);
                if ((beamToHit - beamToTerrain) > 0.25f)
                {
                    hitThing = null;
                    hitPoint = terrainHit;
                }
            }

            if (hitTarget)
            {
                OnHit(shooter, hitThing, hitPoint, beam);
            }
            else if (hitTerrain)
            {
                OnHit(shooter, null, terrainHit, beam);
                ExplosionManager.CreateSpark(terrainHit, 3, 0.4f, 1.0f);
            }

            return(hitTerrain || hitTarget);
        }
Exemple #9
0
 public override void StartUpdate(GameActor gameActor)
 {
     // We need at least two frames to detect changes in score.
     if (frame > 0)
     {
         Scoreboard.Snapshot(scores);
     }
     frame += 1;
 }
Exemple #10
0
 protected override void OnPickup(GameActor owner)
 {
     if (this.Player != null && this.Player.CharacterUsesRandomGuns)
     {
         this.gun.LoseAmmo(1);
         this.Player.ChangeToRandomGun();
     }
     base.OnPickup(owner);
 }
 /// <summary>
 /// Initialize
 /// </summary>
 /// <param Name="actor_index">actor index</param>
 /// <param Name="equip_index">equip item index</param>
 public void Initialize(int actor_index, int equip_index)
 {
     this.actorIndex = actor_index;
     this.equipIndex = equip_index;
     // Get actor
     actor = InGame.Party.Actors[this.actorIndex];
     //Initialize windows
     InitializeWindows();
 }
 /// <summary>
 /// Initialization
 /// </summary>
 /// <param name="actor">Equipped actor</param>
 protected void Initialize(GameActor actor)
 {
     base.Initialize();
     // WindowEquipRight initialization
     this.Contents = new Bitmap(Width - 32, Height - 32);
     this.actor = actor;
     Refresh();
     this.Index = 0;
 }
Exemple #13
0
    public override void ExecuteEnemy(GameActor actor, float deltaTime)
    {
        Enemy enemy = (Enemy)actor;

        if (enemy.Animator.IsDone)
        {
            enemy.TurnNextState();
        }
    }
Exemple #14
0
 /// <summary>
 /// Returns true if this thing should be excluded from being hit.
 /// </summary>
 /// <param name="thing"></param>
 /// <returns></returns>
 private bool ExcludedHitThing(GameActor shooter, GameThing thing)
 {
     return((thing == null) ||
            (thing as CruiseMissile != null) ||
            (thing == shooter) ||
            (thing.ActorHoldingThis == shooter) ||
            ((thing.CurrentState != GameThing.State.Active) &&
             (thing.ActorHoldingThis == null)));
 }
Exemple #15
0
        // Token: 0x06007297 RID: 29335 RVA: 0x002CA4A0 File Offset: 0x002C86A0
        public void ReflectBullet(Projectile p, bool retargetReflectedBullet, GameActor newOwner, float minReflectedBulletSpeed, float scaleModifier = 1f, float damageModifier = 1f, float spread = 0f)
        {
            p.RemoveBulletScriptControl();
            AkSoundEngine.PostEvent("Play_OBJ_metalskin_deflect_01", GameManager.Instance.gameObject);
            bool flag = retargetReflectedBullet && p.Owner && p.Owner.specRigidbody;

            if (flag)
            {
                p.Direction = (p.Owner.specRigidbody.GetUnitCenter(ColliderType.HitBox) - p.specRigidbody.UnitCenter).normalized;
            }
            bool flag2 = spread != 0f;

            if (flag2)
            {
                p.Direction = p.Direction.Rotate(UnityEngine.Random.Range(-spread, spread));
            }
            bool flag3 = p.Owner && p.Owner.specRigidbody;

            if (flag3)
            {
                p.specRigidbody.DeregisterSpecificCollisionException(p.Owner.specRigidbody);
            }
            p.Owner = newOwner;
            p.SetNewShooter(newOwner.specRigidbody);
            p.allowSelfShooting   = false;
            p.collidesWithPlayer  = false;
            p.collidesWithEnemies = true;
            bool flag4 = scaleModifier != 1f;

            if (flag4)
            {
                SpawnManager.PoolManager.Remove(p.transform);
                p.RuntimeUpdateScale(scaleModifier);
            }
            bool flag5 = p.Speed < minReflectedBulletSpeed;

            if (flag5)
            {
                p.Speed = minReflectedBulletSpeed;
            }
            bool flag6 = p.baseData.damage < ProjectileData.FixedFallbackDamageToEnemies;

            if (flag6)
            {
                p.baseData.damage = ProjectileData.FixedFallbackDamageToEnemies;
            }
            p.baseData.damage *= damageModifier;
            bool flag7 = p.baseData.damage < 10f;

            if (flag7)
            {
                p.baseData.damage = 15f;
            }
            p.UpdateCollisionMask();
            p.Reflected();
            p.SendInDirection(p.Direction, true, true);
        }
Exemple #16
0
        /// <summary>
        /// Set the owner actor.
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="parentBone"></param>
        public virtual void SetOwner(GameActor owner)
        {
            this.owner = owner;
            int lod = Math.Max(0, owner.Animators.Count - 1);

            this.animator = owner.Animators[lod];

            UpdateTransforms();
        }
Exemple #17
0
        public override ActionSet ComposeActionSet(Reflex reflex, GameActor gameActor)
        {
            ClearActionSet(actionSet);
            UpdateCanBlend(reflex);

            if (!reflex.targetSet.AnyAction)
            {
                return(actionSet);
            }

            // Don't wander if we are immobilized. The effect is the bot randomly turning in place, which looks broken.
            ConstraintModifier constraintMod = reflex.GetModifierByType(typeof(ConstraintModifier)) as ConstraintModifier;

            if (constraintMod != null && constraintMod.ConstraintType == ConstraintModifier.Constraints.Immobile)
            {
                // We still need to add an attractor to the movement set so that the reflex will be considered acted on.
                // TODO (****) is thre a better way to indicate this?
                actionSet.AddActionTarget(Action.AllocTargetLocationAction(reflex, gameActor.Movement.Position, autoTurn: true));
                return(actionSet);
            }

            // Check if this target has timed out.
            if (Time.GameTimeTotalSeconds > this.wanderTimeout)
            {
                this.pickNewTarget = true;
            }

            // Calculate a vector toward target in 2d.
            Vector2 wanderTarget2d = new Vector2(this.wanderTarget.X, this.wanderTarget.Y);
            Vector2 value2d        = wanderTarget2d - new Vector2(gameActor.Movement.Position.X, gameActor.Movement.Position.Y);

            float distance = Vector3.Dot(wanderDir, gameActor.Movement.Position) - wanderDist + gameActor.BoundingSphere.Radius;

            if (distance > 0)
            {
                this.pickNewTarget = true;
            }

            if (this.pickNewTarget)
            {
                this.pickNewTarget = false;
                // we need to pick a random wander target
                this.wanderTarget  = RandomTargetLocation(gameActor);
                this.wanderTimeout = Time.GameTimeTotalSeconds + maxTimeOnTarget;
            }

            actionSet.AddActionTarget(Action.AllocTargetLocationAction(reflex, wanderTarget, autoTurn: true));

            /// For debugging, uncomment this line and enable Debug: Display Line of Sight
            /// on the character in question.
            gameActor.AddLOSLine(gameActor.Movement.Position,
                                 new Vector3(wanderTarget.X, wanderTarget.Y, gameActor.Movement.Position.Z),
                                 new Vector4(0.0f, 1.0f, 0.0f, 1.0f));

            return(actionSet);
        }
Exemple #18
0
        }   // end of Setup()

        /// <summary>
        /// c'tor for use when targetting a point in space rather than an object.
        /// </summary>
        /// <param name="position"></param>
        /// <param name="targetPosition"></param>
        /// <param name="launcher"></param>
        /// <param name="verbPayload"></param>
        /// <param name="trackingMode"></param>
        /// <param name="color"></param>
        /// <returns></returns>
        static public CruiseMissile Create(
            Vector3 position,                                       // Starting position.
            Vector3 targetPosition,                                 // Location we're trying to hit.
            GameActor launcher,                                     // Actor that launched this missile.
            float initialRotation,                                  //
            GameThing.Verbs verbPayload,
            int damage,
            MissileChassis.BehaviorFlags behavior,
            Classification.Colors color,
            float desiredSpeed,
            float missileLifetime,
            bool wantSmoke)
        {
            CruiseMissile cm = NextAvailable();

            cm.Setup(
                position,
                launcher,
                initialRotation,
                verbPayload,
                damage,
                behavior,
                color,
                desiredSpeed,
                wantSmoke);

            //Vector3 forward = Vector3.Normalize(targetPosition - position);
            //Vector3 side = Vector3.Cross(Vector3.UnitZ, forward);
            //if (side.LengthSquared() < 0.01f)
            //{
            //    side = Vector3.Cross(Vector3.UnitY, forward);
            //}
            //side.Normalize();
            //Vector3 up = Vector3.Normalize(Vector3.Cross(forward, side));
            //Matrix l2w = Matrix.Identity;
            //l2w.Right = forward;
            //l2w.Up = up;
            //l2w.Forward = side;
            //l2w.Translation = position;
            //cm.Movement.LocalMatrix = l2w;

            MissileChassis missileChassis = cm.Chassis as MissileChassis;

            Vector3 direction = targetPosition - launcher.WorldCollisionCenter;
            Vector3 delta     = Vector3.Normalize(direction);

            float desiredPitch = (float)(Math.Atan2(delta.Z, new Vector2(delta.X, delta.Y).Length()));

            missileChassis.PitchAngle = desiredPitch;

            missileChassis.DeathTime      = Time.GameTimeTotalSeconds + missileLifetime * 1.1f;
            missileChassis.TargetPosition = position + delta * desiredSpeed * missileLifetime * 10f;
            missileChassis.TargetObject   = null;

            return(cm);
        }   // end of CruiseMissile Create
        public override void ComposeSensorTargetSet(GameActor gameActor, Reflex reflex)
        {
            List <Filter> filters = reflex.Filters;

            // add normal sightSet of items to the targetset
            //
            senseSetIter.Reset();
            while (senseSetIter.MoveNext())
            {
                SensorTarget target = (SensorTarget)senseSetIter.Current;

                bool match = true;
                bool cursorFilterPresent = false;
                for (int indexFilter = 0; indexFilter < filters.Count; indexFilter++)
                {
                    Filter filter = filters[indexFilter] as Filter;
                    ClassificationFilter cursorFilter = filter as ClassificationFilter;
                    if (cursorFilter != null && cursorFilter.classification.IsCursor)
                    {
                        cursorFilterPresent = true;
                    }

                    if (!filter.MatchTarget(reflex, target))
                    {
                        match = false;
                        break;
                    }
                }
                if (match)
                {
                    if (!target.Classification.IsCursor || cursorFilterPresent)
                    {
                        reflex.targetSet.Add(target);
                    }
                }
            }

            if (ListeningForMusic(filters))
            {
                if (HearMusic(filters))
                {
                    SensorTarget sensorTarget = SensorTargetSpares.Alloc();
                    sensorTarget.Init(gameActor, Vector3.UnitZ, 0.0f);
                    reflex.targetSet.AddOrFree(sensorTarget);
                }
            }

            reflex.targetSet.Action = TestObjectSet(reflex);
            if (reflex.targetSet.Action)
            {
                foreach (SensorTarget targ in reflex.targetSet)
                {
                    gameActor.AddSoundLine(targ.GameThing);
                }
            }
        }
 /// <summary>
 /// Build self out of the list of children primitives. The list will be
 /// cloned, no one from source will be modified or kept.
 /// </summary>
 /// <param name="owner"></param>
 /// <param name="src"></param>
 /// <returns></returns>
 public bool Build(GameActor owner, List <CollisionPrimitive> src)
 {
     children.Clear();
     for (int i = 0; i < src.Count; ++i)
     {
         AddChildClone(owner, src[i]);
     }
     SetOwner(owner);
     return(children.Count > 0);
 }
        protected override bool OnExecute(GameActor gameActor)
        {
            base.OnExecute(gameActor);

            m_BeforeX = gameActor.X;
            m_BeforeY = gameActor.Y;
            gameActor.Move(m_X, m_Y);

            return(true);
        }
Exemple #22
0
 public Command ButtonEndTurn()
 {
     if (bActionUI)
     {
         EndTurnCommand command = new EndTurnCommand(selectedActor);
         this.selectedActor = null;
         return(command);
     }
     return(null);
 }
Exemple #23
0
        public void Init(ModularSpell owner)
        {
            _owner = owner.owner;
            if (!animateCaster)
            {
                _animator = _owner.GetComponent <Animator>();
            }

            owner.AddOnHitAction(this);
        }
        public override void OnInitializedWithOwner(GameActor actor)
        {
            Gun boneGun = PickupObjectDatabase.GetById(812) as Gun;

            gun.DefaultModule.projectiles[0]      = boneGun.DefaultModule.projectiles[0];
            gun.DefaultModule.numberOfShotsInClip = 10;
            gun.DefaultModule.ammoType            = GameUIAmmoType.AmmoType.SKULL;
            isBeam = false;
            base.OnInitializedWithOwner(actor);
        }
Exemple #25
0
 public override void FinishUpdate(GameActor gameActor)
 {
     if (gameActor.ThingBeingHeldByThisActor != null)
     {
         // presence is only thing important here
         SensorTarget target = SensorTargetSpares.Alloc();
         target.Init(gameActor, gameActor.ThingBeingHeldByThisActor);
         senseSet.AddOrFree(target);
     }
 }
Exemple #26
0
 // Use this for initialization
 void Start()
 {
     this.inputHandler  = new InputHandler();
     this.selectedActor = inputHandler.GetSelectedActor();
     this.turnManager   = new TurnManager();
     //coinCount = 0;
     //countText.text = coinCount.ToString ();
     this.selectedActor = turnManager.GetCurrentMinion();
     this.inputHandler.SetGameActor(selectedActor);
 }
Exemple #27
0
        public void ReplaceWith(GameActorPosition original, GameActor replacement)
        {
            if ((original.Actor is Tile && replacement is GameObject) ||
                (original.Actor is GameObject && replacement is Tile))
            {
                throw new ArgumentException("atlas.ReplaceWith tries replace Tile with GameObject or GameObject with Tile");
            }

            GetLayer(original.Layer).ReplaceWith(original, replacement);
        }
Exemple #28
0
        public override void OnInitializedWithOwner(GameActor actor)
        {
            base.OnInitializedWithOwner(actor);
            PlayerController player = gun.CurrentOwner as PlayerController;

            if (actor == player)
            {
                this.HandleRadialIndicator(TRadius, player.sprite);
            }
        }
        /// <summary>
        /// Executes the OnHitActions after a certain delay.
        /// </summary>
        /// <param name="delay"> Delay in seconds</param>
        /// <param name="actor"> GameActor that was hit</param>
        /// <param name="castDirection"> Direction the spell was cast</param>
        /// <param name="movementDirection"> Movement direction the player inputted</param>
        /// <returns></returns>
        private IEnumerator DelayOnHitEffects(float delay, GameActor actor, Vector3 castDirection,
                                              Vector3 movementDirection)
        {
            yield return(new WaitForSeconds(delay));

            foreach (IOnHitAction onHitAction in OnHitActions)
            {
                onHitAction.OnHit(actor, castDirection, movementDirection);
            }
        }
 public override void OnEffectRemoved(GameActor actor, RuntimeGameActorEffectData effectData)
 {
     try
     {
         actor.healthHaver.AllDamageMultiplier -= counter.HowMuchToRemove;
     } catch (Exception error)
     {
         error.ToString().Log();
     }
 }
Exemple #31
0
 public new void Initialize(GameActor owner)
 {
     orig_Initialize(owner);
     if (owner is PlayerController)
     {
         OnPostFired    += ETGMod.Gun.OnPostFired;
         OnFinishAttack += ETGMod.Gun.OnFinishAttack;
         ETGMod.Gun.OnInit?.Invoke((PlayerController)owner, this);
     }
 }
Exemple #32
0
        public override void OnEffectRemoved(GameActor actor, RuntimeGameActorEffectData effectData)
        {
            var hand = actor.transform.Find("money22VFX").gameObject;

            UnityEngine.Object.Destroy(hand);

            actor.DeregisterOverrideColor(vfxNamemoney2);
            base.OnEffectRemoved(actor, effectData);
            actor.healthHaver.AllDamageMultiplier -= -0.3f;
        }
        public void WeaponlessActorDoesNoDamage()
        {
            var a = new GameActor();
            var b = new GameActor();

            a.Attack(b);

            Assert.AreEqual(b.baseHealth, b.Health);
            Assert.IsTrue(b.Alive);
        }
Exemple #34
0
    void Start()
    {
        timeOfLastMoveCmd = Time.time;

        lastReceivedMove = transform.position;

        ownerInfo = GetComponent <OwnerInfo>();
        actorInfo = GetComponent <GameActor>();
        isMine    = (ownerInfo.OwnerID == StarCollectorClient.PlayerID);
    }
        public void ScryptCanAccessAlignmentEnum()
        {
            var testActor = new GameActor();

            testActor.SetScrypt(@"
                if (Alignment_Mob == undefined || Alignment_Player == undefined) {
                    throw 'GameActor enums do not exist?';
                }
            ");
        }
Exemple #36
0
        protected override void OnPickup(GameActor owner)
        {
            base.OnPickup(owner);
            Gun gun = ETGMod.Databases.Items["ak_188"] as Gun;

            if ((owner as PlayerController).HasGun(gun.PickupObjectId))
            {
                (owner as PlayerController).inventory.DestroyGun(gun);
            }
        }
        private void Start()
        {
            GameActor gameActor = ActorSys.Instance.GetMainActor();

            mGameActor = gameActor;
            BuffCmpt buffCmpt = mGameActor.GetBuffCmpt();

            buffCmpt.AddOnBuffAddListener(OnAddBuff);
            buffCmpt.AddOnRemoveAddListener(OnRemoveBuff);
        }
        }   // end of AddUserControlled()

        /// <summary>
        /// Tell the camera to ignore the actor.
        /// </summary>
        /// <param name="actor">The actor to ignore</param>
        public static void AddIgnoreMe(GameActor actor)
        {
            // Remove this actor from the first person stack if there.
            brainFirstPersonStack.Remove(actor);

            if (!brainIgnoreMeList.Contains(actor))
            {
                brainIgnoreMeList.Add(actor);
            }
        }   // end of AddIgnoreMe()
 /// <summary>
 /// Initialization
 /// </summary>
 /// <param name="actor">equipped actor</param>
 /// <param name="equipType">equip region (0-3)</param>
 protected void Initialize(GameActor actor, int equipType)
 {
     base.Initialize();
     // WindowEquipItem initialization
     this.actor = actor;
     this.equipType = equipType;
     columnMax = 2;
     Refresh();
     this.IsActive = false;
     this.Index = -1;
 }
Exemple #40
0
	public override void Execute(GameActor ga)
    {
        if(moveRight)
        {
            ga.MoveRight();
        }
        else
        {
            ga.MoveLeft();    
        }
    }
    // Use this for initialization
    void Start()
    {
        timeOfLastMoveCmd = Time.time;

        lastReceivedMove = transform.position;

        ownerInfo = GetComponent<OwnerInfo>();
        actorInfo = GetComponent<GameActor>();
        isMine = (ownerInfo.OwnerID == StarCollectorClient.playerID);

        Camera.main.transform.parent = this.transform;
        Camera.main.transform.localPosition = new Vector3(0f, 14f, 0f);
    }
    public void EatFood( GameActor actor, int row, int column )
    {
        if ( !IsPosValid ( row, column ) ) {
            Debug.LogError ( "<NavigationMap::EatFood>, invalid index, row : " + row + ", column: " + column );
        }

        if ( collision_map_[row, column] != NodeType.food ) {
            Debug.LogError ( "<NavigationMap::EatFood>, man, it's not food" );
        }

        if ( GameSettings.GetInstance().FOOD_DISAPEAR_AFTER_EATING ) {
            collision_map_[row, column] = NodeType.normal;
        }
    }
Exemple #43
0
 /// <summary>
 /// Set actor displayed in window
 /// </summary>
 /// <param Name="actor">status displaying actor</param>
 public void SetActor(GameActor actor)
 {
     if (actor != this.actor)
     {
         this.Contents.Clear();
         DrawActorName(actor, 4, 0);
         DrawActorState(actor, 140, 0);
         DrawActorHp(actor, 284, 0);
         DrawActorSp(actor, 460, 0);
         this.actor = actor;
         this.text = null;
         this.IsVisible = true;
     }
 }
Exemple #44
0
 /// <summary>
 /// Set the text string displayed in window
 /// </summary>
 /// <param Name="text">text string displayed in window</param>
 /// <param Name="align">alignment (0..flush left, 1..center, 2..flush right)</param>
 public void SetText(string text, int align)
 {
     // If at least one part of text and alignment differ from last time
     if (text != this.text || align != this.align)
     {
         // Redraw text
         this.Contents.Clear();
         this.Contents.Font.Color = NormalColor;
         this.Contents.DrawText(4, 0, this.Width - 40, 32, text, align);
         this.text = text;
         this.align = align;
         this.actor = null;
     }
     this.IsVisible = true;
 }
Exemple #45
0
        /// <summary>
        /// Deal Damage for Actor
        /// </summary>
        /// <param Name="Battler">Actor</param>
        void dealDamage(int value, GameActor battler)
        {
            // If Battler exists
			if (battler.IsExist)
            {
                // Change HP
				battler.Hp -= value;
                // If in battle
				if (InGame.Temp.IsInBattle)
                {
                    // Set damage
					battler.Damage = value.ToString();
					battler.IsDamagePop = true;
                }
            }
		}
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param Name="actor">actor whom Name is edited</param>
 /// <param Name="max_char">maximum number of characters</param>
 public WindowNameEdit(GameActor actor, int max_char)
     : base(0, 0, 640, 128)
 {
     this.Contents = new Bitmap(Width - 32, Height - 32);
     this.actor = actor;
     Name = actor.Name;
     this.maxChar = max_char;
     // Fit Name within maximum number of characters
     char[] name_array = Name.ToCharArray();
     Name = "";
     for (int i = 0; i < name_array.Length; i++)
     {
         Name += name_array[i];
     }
     defaultName = Name;
     Index = name_array.Length;
     Refresh();
     update_cursor_rect();
 }
Exemple #47
0
 /// <summary>
 /// Window Initialization
 /// </summary>
 protected void Initialize(GameActor actor)
 {
     base.Initialize();
     // WindowSkill initialization
     this.actor = actor;
     columnMax = 2;
     Refresh();
     if (itemMax > 0)
     {
         this.Index = 0;
     }
     // If in battle, move window to center of screen
     // and make it semi-transparent
     if (InGame.Temp.IsInBattle)
     {
         this.Y = 64;
         this.Height = GeexEdit.GameWindowHeight - 224;
         this.BackOpacity = 160;
     }
 }
    public int EatHuman( GameActor actor, int row, int column )
    {
        if ( !IsPosValid ( row, column ) ) {
            Debug.LogError ( "<NavigationMap::EatHuman>, invalid index, row : " + row + ", column: " + column );
        }

        int kill_counter = 0;
        // just eat the first human
        GameActor target_actor = null;
        bool is_dino_died = false;
        bool is_human_died = false;
        for ( int i = 0; i < actor_map_[row,column].Count; ++i ) {
            target_actor = actor_map_[row,column][i];

            if ( !target_actor.isAlive() )
                continue;

            if ( target_actor.Type() == ActorType.human ) {
                if ( actor.isAlive() && target_actor.isAlive() ) {
                    actor.Combat ( target_actor );
                    if ( !target_actor.isAlive() ) {
                        ++kill_counter;
                        is_human_died = true;
                        ++GameStatics.human_died;
                    }

                    if ( !actor.isAlive() ) {
                        is_dino_died = true;
                        ++GameStatics.monster_died;
                    }
                }
            }
        }

        if ( is_dino_died ) {
            scene_game_.PlayAudioDinoDie ();
        } else if ( is_human_died ) {
            scene_game_.PlayAudioHumanDie ();
        }
        return kill_counter;
    }
Exemple #49
0
 protected override void Act(GameActor objectid, Transform obj)
 {
     switch (objectid)
     {
         case GameActor.P3_CRUMBS:
             if (cState == State.IDLE && !text[1].GetComponent<Typewriter>().typing)
             {
                 interactible[0].SetActive(false);
                 text[1].GetComponent<Typewriter>().LoadText("These crumbs look fresh");
                 text[1].GetComponent<Typewriter>().AppendText(". . . \n", 0.5f);
                 text[1].GetComponent<Typewriter>().AppendText("Where do they lead?", 0.08f);
                 cState = State.BATHROOM;
             }
             break;
         case GameActor.P3_COUCH:
             if ((cState == State.IDLE || cState == State.BATHROOM) && !text[2].GetComponent<Typewriter>().typing)
             {
                 interactible[1].SetActive(false);
                 text[2].GetComponent<Typewriter>().LoadText("Bite marks, all over");
             }
             break;
         //
         // Handle Search
         // active objects when searching for handle
         case GameActor.P3_K_TRASH:
             if(interactible[9].GetComponent<Text>().text.Length == 0) {
                 interactible[9].GetComponent<Typewriter>().LoadText("Is it in the trash?");
             }
             else if (Input.GetButtonDown("Act"))
             {
                 interactible[9].SetActive(false);
                 text[6].GetComponent<Typewriter>().LoadText("Nothing here...");
                 if (!interactible[8].activeSelf)
                 {
                     interactible[7].SetActive(true);
                     interactible[7].GetComponent<Typewriter>().LoadText("Is it in the living room?");
                 }
             }
             break;
         case GameActor.P3_K_FRIDGE:
             if (interactible[8].GetComponent<Text>().text.Length == 0)
             {
                 interactible[8].GetComponent<Typewriter>().LoadText("Is it in the fridge?");
             }
             else if (Input.GetButtonDown("Act"))
             {
                 interactible[8].SetActive(false);
                 props[6].SetActive(false);
                 props[7].SetActive(true);
                 props[7].GetComponent<AudioSource>().Play();
                 text[5].GetComponent<Typewriter>().LoadText("Nothing...\nMom needs to buy groceries.");
                 if (!interactible[9].activeSelf)
                 {
                     interactible[7].SetActive(true);
                     interactible[7].GetComponent<Typewriter>().LoadText("Is it in the living room?");
                 }
             }
             break;
         case GameActor.P3_L_SHELVES:
             if (interactible[10].GetComponent<Text>().text.Length == 0)
             {
                 interactible[10].GetComponent<Typewriter>().LoadText("Can it be\nhere?");
             }
             else if (Input.GetButtonDown("Act"))
             {
                 interactible[10].SetActive(false);
                 text[7].GetComponent<Typewriter>().LoadText(" no books,\nno handle...");
                 if (!interactible[11].activeSelf)
                 {
                     interactible[12].SetActive(true);
                     interactible[12].GetComponent<Typewriter>().LoadText("How about the bathroom?");
                 }
             }
             break;
         case GameActor.P3_L_TRASH:
             if (interactible[11].GetComponent<Text>().text.Length == 0)
             {
                 interactible[11].GetComponent<Typewriter>().LoadText("In here?");
             }
             else if (Input.GetButtonDown("Act"))
             {
                 interactible[11].SetActive(false);
                 text[8].GetComponent<Typewriter>().LoadText("Nothing but trash here...");
                 if (!interactible[10].activeSelf)
                 {
                     interactible[12].SetActive(true);
                     interactible[12].GetComponent<Typewriter>().LoadText("How about the bathroom?");
                 }
             }
             break;
         case GameActor.P3_B_TUB:
             if (interactible[14].GetComponent<Text>().text == "") {
                 interactible[14].GetComponent<Typewriter>().LoadText("behind here?");
             }
             else if (Input.GetButtonDown("Act")) {
                 interactible[14].SetActive(false);
                 isWaiting = false;
             }
             break;
         case GameActor.P3_COMPUTER:
             if(cState == State.IDLE_COMPUTER) {
                 cState = State.LR_COMPUTER;
             }
             else if (cState == State.LR_COMPUTER && Input.GetButtonDown("Act"))
             {
                 interactible[15].SetActive(false);
                 isWaiting = false;
             }
             break;
         //
         // Player Look at colliders
         // hidden objects that trigger text when the player
         // looks at them
         case GameActor.OBJ_BATH_MIRROR:
             interactible[4].SetActive(false);
             cState = State.BATHROOM_MIRROR;
             break;
         case GameActor.OBJ_K_OVEN:
             interactible[6].SetActive(false);
             cState = State.EXPLORE;
             break;
         case GameActor.OBJ_FS_TV:
             if (!isTVOn) {
                 StartCoroutine(TV());
             }
             break;
         case GameActor._GO_TO_BATHROOM:
             if (Input.GetButtonDown("Act")) {
                 interactible[2].SetActive(false);
                 Target = GameActor._GO_TO_BATHROOM;
                 ui[0].SetActive(false);
                 ui[1].SetActive(false);
                 interactible[0].SetActive(false);
                 interactible[1].SetActive(false);
                 interactible[2].SetActive(false);
                 interactible[4].SetActive(true);
             }
             break;
         case GameActor._GO_TO_LIVING_ROOM_BATH:
             if (cState == State.IDLE && Input.GetButtonDown("Act"))
             {
                 interactible[5].SetActive(false);
                 Target = GameActor._GO_TO_LIVING_ROOM_BATH;
                 interactible[15].SetActive(true);
                 cState = State.IDLE_COMPUTER;
             }
             break;
         case GameActor._GO_TO_LIVING_ROOM_KITCHEN:
             if (Input.GetButtonDown("Act"))
             {
                 Target = GameActor._GO_TO_LIVING_ROOM_KITCHEN;
             }
             break;
         case GameActor.P3_E_BATHROOM:
             if (Input.GetButtonDown("Act"))
             {
                 cState = State.BATHTUB;
                 Target = GameActor._GO_TO_BATHROOM;
             }
             break;
         case GameActor.P3_E_KITCHEN:
             if ((cState == State.BATHTUB || cState == State.BATHROOM_MIRROR) && Input.GetButtonDown("Act")) {
                 interactible[13].SetActive(false);
                 interactible[13].GetComponent<Text>().text = "";
                 isWaiting = false;
             }
             else if (cState == State.IDLE && Input.GetButtonDown("Act"))
             {
                 Target = GameActor._GO_TO_KITCHEN;
                 isDone = true;
             }
             break;
         case GameActor._GO_TO_KITCHEN:
             if (Input.GetButtonDown("Act"))
             {
                 interactible[3].SetActive(false);
                 text[11].GetComponent<Text>().text = "";
                 ui[2].SetActive(false);
                 interactible[6].SetActive(true);
                 text[11].GetComponent<Typewriter>().SetText("");
                 Target = GameActor._GO_TO_KITCHEN;
                 cState = State.IDLE;
                 StopCoroutine(co);
                 co = StartCoroutine(UpdateState()); // hack - restart co routine to stop pc text :)
             }
             break;
         default:
             break;
     }
 }
Exemple #50
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param Name="actor">actor</param>
 public WindowSkill(GameActor actor)
     : base(0, 128, GeexEdit.GameWindowWidth, GeexEdit.GameWindowHeight - 128)
 {
     Initialize(actor);
 }
Exemple #51
0
 /// <summary>
 /// Initialize
 /// </summary>
 /// <param Name="actor_index">actor index</param>
 /// <param Name="equip_index">equip item index</param>
 public void Initialize(int actor_index, int equip_index)
 {
     this.actorIndex = actor_index;
     this.equipIndex = equip_index;
     // Get actor
     actor = InGame.Party.Actors[this.actorIndex];
     //Initialize windows
     InitializeWindows();
 }
Exemple #52
0
	public override void Execute(GameActor ga)
    {
        ga.Jump();
    }
	public override void Execute(GameActor ga)
    {
        ga.AirTotem(level);
    }
 /// <summary>
 /// Manage drawing relative to armor changing
 /// </summary>
 /// <param Name="actor">actor</param>
 /// <param Name="armor">selected item in the window</param>
 /// <param Name="i">iterator</param>
 /// <returns>current armor</returns>
 public Armor ArmorChangeDrawer(GameActor actor, Armor armor, int i)
 {
     Armor _current_armor = null;
     if (armor.Kind == 0)
     {
         _current_armor = Data.Armors[actor.ArmorShield];
     }
     else if (armor.Kind == 1)
     {
         _current_armor = Data.Armors[actor.ArmorHelmet];
     }
     else if (armor.Kind == 2)
     {
         _current_armor = Data.Armors[actor.ArmorBody];
     }
     else
     {
         _current_armor = Data.Armors[actor.ArmorAccessory];
     }
     // If equippable
     if (actor.IsEquippable(armor))
     {
         int change = 0;
         int _pdef1 = _current_armor != null ? _current_armor.Pdef : 0;
         int _mdef1 = _current_armor != null ? _current_armor.Mdef : 0;
         int _pdef2 = armor != null ? armor.Pdef : 0;
         int _mdef2 = armor != null ? armor.Mdef : 0;
         // Create change string
         change = _pdef2 - _pdef1 + _mdef2 - _mdef1;
         string changeString = "";
         changeString = change > 0 ? "+" + change.ToString() : change.ToString();
         // Draw parameter change values
         this.Contents.DrawText(124, 64 + 64 * i, 112, 32, changeString, 2);
     }
     return _current_armor;
 }
 void SetOwner(GameActor ga)
 {
     this.owner = ga;
 }
 /// <summary>
 /// Manage drawing relative to weapon changing
 /// </summary>
 /// <param Name="actor">actor</param>
 /// <param Name="weapon">selected item in the window</param>
 /// <param Name="i">iterator</param>
 /// <returns>current weapon</returns>
 public Weapon WeaponChangeDrawer(GameActor actor, Weapon weapon, int i)
 {
     Weapon _current_weapon = null;
     _current_weapon = Data.Weapons[actor.WeaponId];
     // If equippable
     if (actor.IsEquippable(weapon))
     {
         int change = 0;
         int atk1 = _current_weapon != null ? _current_weapon.Atk : 0;
         int atk2 = weapon != null ? weapon.Atk : 0;
         // Create change string
         change = atk2 - atk1;
         string changeString = "";
         changeString = change > 0 ? "+" + change.ToString() : change.ToString();
         // Draw parameter change values
         this.Contents.DrawText(124, 64 + 64 * i, 112, 32, changeString, 2);
     }
     return _current_weapon;
     
 }
Exemple #57
0
 protected override void Clean(GameActor objectid, Transform obj)
 {
     return;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param Name="actor">equipped actor</param>
 /// <param Name="equip_type">equip region (0-3)</param>
 public WindowEquipItem(GameActor actor, int equipType)
     : base(0, 256, GeexEdit.GameWindowWidth, GeexEdit.GameWindowHeight - 256)
 {
     Initialize(actor, equipType);
 }
 public override void execute(GameActor actor)
 {
     actor.lurchIneffectively();
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param Name="actor">Equipped actor</param>
 public WindowEquipRight(GameActor actor)
     : base(272, 64, GeexEdit.GameWindowWidth - 272, 192)
 {
     Initialize(actor);
 }