public override void SetPawn(PawnComponent Pawn) { if (Pawn) { _refPawn = Pawn; } }
public override void SetPawn(PawnComponent Pawn) { if (Pawn) { _refPawn = Pawn; _refPawn.OnDeath += Destroy; } }
public override IEnumerator ActionOverTime(PawnComponent Pawn) { for (int i = 0; i < NSpawn; i++) { Spawn(PrefabSpawn, OffsetSpawn[i % OffsetSpawn.Length] + Pawn.GetPosition(), RotationSpawn[i % RotationSpawn.Length]); } yield break; }
public AbstractController GetNewController(EntityConfig Data, PawnComponent InstancePawn) { var controller = _pool.GetItem <AbstractController>(Data.PrefabControllerPawn.Controller); controller.Init(Data.ControllerConfig); controller.SetPawn(InstancePawn); controller.gameObject.SetActive(true); return(controller); }
public BaseCommande[] GetPawnCmds(PawnComponent refPawn, EntityComponent entity) { var cmds = new BaseCommande[CmdsScriptable.Length]; for (int i = 0; i < cmds.Length; i++) { cmds[i] = CmdsScriptable[i].Generate(refPawn, entity); } return(cmds); }
private void CreatePlayer(out PawnComponent instancePawn, out PlayerController instanceController) { var instance = GameObject.Instantiate(PrefabPawn); var transPawn = instance.transform; transPawn.position = StartPoint.position; instancePawn = instance.GetComponent <PawnComponent>(); instance = GameObject.Instantiate(PrefabController); instanceController = instance.GetComponent <PlayerController>(); }
/* * Can only be called once to generate the initial gameObject, which should be * modified after that. */ public void generateRenderObject() { if (renderObject == null) { renderObject = new GameObject(); renderObject.name = "Pawn_" + guid; renderObject.layer = LayerMask.NameToLayer("Pawn"); renderObject.transform.parent = level.getPawnObjectContainer().transform; PawnComponent comp = renderObject.AddComponent <PawnComponent>(); comp.pawn = this; } }
public override IEnumerator ActionOverTime(PawnComponent Pawn) { Vector3 _origine = Pawn.GetPosition(); Vector3 _currentOffset = Vector3.zero; for (float t = 0f, perc = 0f; perc < 1f; t += Time.fixedDeltaTime) { perc = Mathf.Clamp01(t / Duration); _currentOffset.x = VecMove.x * perc; _currentOffset.y = VecMove.y * perc; Pawn.SetPosition(_origine + _currentOffset); yield return(_waitFixed); } }
public void Init(PawnComponent pawn, PawnComponent otherPawn, bool enableSwitchPawn, int index) { Target = pawn; Target.Init(otherPawn); if (enableSwitchPawn) { Target.OnShootPawn += () => Target = Target.TargetShoot; otherPawn.OnShootPawn += () => Target = Target.TargetShoot; otherPawn.Init(pawn); } KeyPlayerInput = "P" + (index + 1); pawn.GetComponentInChildren <SpriteRenderer>().color = index == 0 ? Color.green : Color.blue; }
public static Pawn getPawnFromPawnComponent(GameObject obj) { PawnComponent comp = (PawnComponent)obj.GetComponent <PawnComponent>(); return(comp.pawn); }
public override AbstractPlugAI Generate(PawnComponent pawn) { return(new PlayerPlugAI(pawn)); }
public override IEnumerator ActionOverTime(PawnComponent Pawn) { Pawn.SelfDestroy(); yield break; }
public override IEnumerator ActionOverTime(PawnComponent Pawn) { yield break; }
public abstract IEnumerator ActionOverTime(PawnComponent Pawn);
public override IEnumerator ActionOverTime(PawnComponent Pawn) { yield return(new WaitForSeconds(Duration)); }
public abstract BaseCommande Generate(PawnComponent pawn, EntityComponent entity);
public void Init(PawnComponent target) { TargetShoot = target; }
public override AbstractPlugAI Generate(PawnComponent pawn) { return(new EnemyBasicPlugAI(pawn, Data)); }
public abstract AbstractPlugAI Generate(PawnComponent pawn);
public override BaseCommande Generate(PawnComponent pawn, EntityComponent entity) { return(new CommandeAttackDistance(pawn, Data, entity)); }
public void GetNewEntity(EntityConfig Data, Vector3 Position, out PawnComponent pawn, out AbstractController controller) { pawn = GetNewPawn(Data, Position); controller = GetNewController(Data, pawn); }
public GameObject SpawnCard(CardDescriptionClass CardDescription, bool build_mode) { GameObject Card; CardInteraction CardInteraction; GameObject Pawn; Pawn PawnComponent; SpriteRenderer cardSpriteRenderer; if (!CardDescription.CardEnabled) { return(null); } Card = (GameObject)Instantiate(CardPrefab, new Vector3(0, 0, 0), Quaternion.identity); Pawn = Card.transform.Find("Pawn").gameObject; Pawn.GetComponent <SpriteRenderer> ().sprite = CardDescription.Background; Pawn.transform.Find("Character").gameObject.GetComponent <SpriteRenderer> ().sprite = CardDescription.Character; cardSpriteRenderer = Card.GetComponent <SpriteRenderer> (); PawnComponent = Pawn.GetComponent <Pawn> (); PawnComponent.CardID = CardDescription.CardID; PawnComponent.Name = CardDescription.Name; PawnComponent.Desc = CardDescription.Description; PawnComponent.CardType = CardDescription.CardMode; PawnComponent.SetAttack(CardDescription.Attack); PawnComponent.SetHealth(CardDescription.Health); PawnComponent.SetConfig(CardDescription.PawnConfig, CardDescription.SpecialMovement); PawnComponent.ApplyConfig(); PawnComponent.ItemApplyConfig = CardDescription.ItemChangePawnConfig; PawnComponent.ItemMergeConfig = CardDescription.ItemMergePawnConfig; if (CardDescription.BulletParticlePrefab != null) { PawnComponent.ShotParticlePrefab = CardDescription.BulletParticlePrefab; } PawnComponent.ShootingMode = CardDescription.ShootingMode; PawnComponent.ShootInterval = CardDescription.ShootInterval; PawnComponent.PawnEffectParameters = CardDescription.EffectParameters; PawnComponent.PawnEffectParticle = CardDescription.EffectParticles; if (CardDescription.DeathSound != null) { PawnComponent.DeathSound = CardDescription.DeathSound; } CardInteraction = Card.GetComponent <CardInteraction> (); CardInteraction.SetName(CardDescription.Name); CardInteraction.SetDescription(CardDescription.Description); CardInteraction.SetCardCost(CardDescription.Cost); CardInteraction.SetCardOrder(1); CardInteraction.CardRole = CardDescription.Role; CardInteraction.CardRarity = CardDescription.Rarity; if (CardDescription.CardMode == CardTypesEnum.Pawn) { CardInteraction.SetTypeDescText("Postać"); } else if (CardDescription.CardMode == CardTypesEnum.Weapon) { CardInteraction.SetTypeDescText("Ekwipunek"); } else if (CardDescription.CardMode == CardTypesEnum.Effect) { CardInteraction.SetTypeDescText("Efekt"); } if (CardDescription.Rarity == CardInteraction.CardRarityEnum.common) { cardSpriteRenderer.sprite = SilverCardSprite; } else if (CardDescription.Rarity == CardInteraction.CardRarityEnum.gold) { cardSpriteRenderer.sprite = GoldCardSprite; } else if (CardDescription.Rarity == CardInteraction.CardRarityEnum.diamond) { cardSpriteRenderer.sprite = DiamondCardSprite; } if (!build_mode) { if (CardDescription.EffectComponent.Length > 0) { Type componentType = Type.GetType(CardDescription.EffectComponent); if (componentType != null) { Pawn.AddComponent(componentType); } else { Debug.LogWarning("You are missing to add component class named: " + CardDescription.EffectComponent); } } } Card.SetActive(true); return(Card); }
public abstract void SetPawn(PawnComponent Pawn);