コード例 #1
0
 public override void SetPawn(PawnComponent Pawn)
 {
     if (Pawn)
     {
         _refPawn = Pawn;
     }
 }
コード例 #2
0
 public override void SetPawn(PawnComponent Pawn)
 {
     if (Pawn)
     {
         _refPawn          = Pawn;
         _refPawn.OnDeath += Destroy;
     }
 }
コード例 #3
0
ファイル: ActionData.cs プロジェクト: Arcanils/PewPew
 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;
 }
コード例 #4
0
ファイル: EntityFactory.cs プロジェクト: Arcanils/PewPew
    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);
    }
コード例 #5
0
ファイル: EntityConfig.cs プロジェクト: Arcanils/Sparta2D
    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);
    }
コード例 #6
0
ファイル: GameplayController.cs プロジェクト: Arcanils/DuoP
    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>();
    }
コード例 #7
0
    /*
     * 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;
        }
    }
コード例 #8
0
ファイル: ActionData.cs プロジェクト: Arcanils/PewPew
    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);
        }
    }
コード例 #9
0
    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;
    }
コード例 #10
0
    public static Pawn getPawnFromPawnComponent(GameObject obj)
    {
        PawnComponent comp = (PawnComponent)obj.GetComponent <PawnComponent>();

        return(comp.pawn);
    }
コード例 #11
0
 public override AbstractPlugAI Generate(PawnComponent pawn)
 {
     return(new PlayerPlugAI(pawn));
 }
コード例 #12
0
ファイル: ActionData.cs プロジェクト: Arcanils/PewPew
 public override IEnumerator ActionOverTime(PawnComponent Pawn)
 {
     Pawn.SelfDestroy();
     yield break;
 }
コード例 #13
0
ファイル: ActionData.cs プロジェクト: Arcanils/PewPew
 public override IEnumerator ActionOverTime(PawnComponent Pawn)
 {
     yield break;
 }
コード例 #14
0
ファイル: ActionData.cs プロジェクト: Arcanils/PewPew
 public abstract IEnumerator ActionOverTime(PawnComponent Pawn);
コード例 #15
0
ファイル: ActionData.cs プロジェクト: Arcanils/PewPew
 public override IEnumerator ActionOverTime(PawnComponent Pawn)
 {
     yield return(new WaitForSeconds(Duration));
 }
コード例 #16
0
ファイル: EntityConfig.cs プロジェクト: Arcanils/Sparta2D
 public abstract BaseCommande Generate(PawnComponent pawn, EntityComponent entity);
コード例 #17
0
 public void Init(PawnComponent target)
 {
     TargetShoot = target;
 }
コード例 #18
0
 public override AbstractPlugAI Generate(PawnComponent pawn)
 {
     return(new EnemyBasicPlugAI(pawn, Data));
 }
コード例 #19
0
 public abstract AbstractPlugAI Generate(PawnComponent pawn);
コード例 #20
0
 public override BaseCommande Generate(PawnComponent pawn, EntityComponent entity)
 {
     return(new CommandeAttackDistance(pawn, Data, entity));
 }
コード例 #21
0
ファイル: EntityFactory.cs プロジェクト: Arcanils/Sparta2D
 public void GetNewEntity(EntityConfig Data, Vector3 Position, out PawnComponent pawn, out AbstractController controller)
 {
     pawn       = GetNewPawn(Data, Position);
     controller = GetNewController(Data, pawn);
 }
コード例 #22
0
ファイル: CardsBase.cs プロジェクト: Niezoor/ScriptsDemo
    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);
    }
コード例 #23
0
 public abstract void SetPawn(PawnComponent Pawn);