Esempio n. 1
0
        public void OnSpawned(SpawnContext spawnContext, ProjectilesPool projectilesPool)
        {
            contactFilter = new ContactFilter2D()
            {
                useLayerMask = true,
                useTriggers  = true
            };

            faction = spawnContext.Instigator.Faction;

            meshRenderer.SetEmission(spawnContext.Color);

            //manage parameters regarding instigator faction
            switch (spawnContext.Instigator.Faction)
            {
            case EFaction.Player:
                contactFilter.layerMask = Layers.Bit.Enemy | Layers.Bit.EnemyProjectile;
                this.gameObject.layer   = Layers.Int.PlayerProjectile;
                break;

            case EFaction.Enemy:
                contactFilter.layerMask = Layers.Bit.Player | Layers.Bit.PlayerProjectile;
                this.gameObject.layer   = Layers.Int.EnemyProjectile;
                break;

            default:
                break;
            }
            attachedPool = projectilesPool;
            context      = spawnContext;

            transform.rotation = Quaternion.LookRotation(Vector3.forward, context.Direction);
            transform.position = context.Position;
        }
Esempio n. 2
0
        /// <summary>
        /// Create a dropdown menu at a specific position.
        /// </summary>
        /// <param name="canvas">The UI Canvas to create the menu in.</param>
        /// <param name="rootNode">The root node of the menu to spawn.</param>
        /// <param name="loc">The UI location to spawn the menu.</param>
        /// <returns>The context information of the created menu.</returns>
        public SpawnContext CreateDropdownMenu(Canvas canvas, Node rootNode, Vector3 loc)
        {
            SpawnContext sc = new SpawnContext(canvas, this);

            sc.CreateDropdownMenu(rootNode, loc);
            return(sc);
        }
Esempio n. 3
0
        /// <summary>
        /// Create a dropdown around a RectTransform - mimicing if the RectTransform was a
        /// pulldown menu.
        /// </summary>
        /// <param name="canvas">The UI Canvas to create the menu in.</param>
        /// <param name="rootNode">The root node of the menu to spawn.</param>
        /// <param name="rtInvokingRect">The RectTransform to create the menu around.</param>
        /// <returns>The context information of the created menu.</returns>
        public SpawnContext CreateDropdownMenu(Canvas canvas, Node rootNode, RectTransform rtInvokingRect)
        {
            SpawnContext sc = new SpawnContext(canvas, this);

            sc.CreateDropdownMenu(rootNode, rtInvokingRect);
            return(sc);
        }
Esempio n. 4
0
        public void OnSpawned(SpawnContext spawnContext, EnemyPool enemyPool)
        {
            Initialize();

            faction = EFaction.Enemy;

            context            = spawnContext;
            transform.position = spawnContext.Position;
            this.enemyPool     = enemyPool;
        }
        public override void OnSpawned(SpawnContext context, ProjectileHitFxPool pool)
        {
            base.OnSpawned(context, pool);
            this.pool = pool;

            transform.position = context.Position;

            particlesRenderer.SetEmission(context.ColorHD);

            PlayParticles();
        }
Esempio n. 6
0
        public void OnSpawned(SpawnContext spawnContext, MiniBossPool pool)
        {
            Initialize();

            this.pool          = pool;
            faction            = EFaction.Enemy;
            context            = spawnContext;
            transform.position = context.Position;

            RandomizeTargetPosition();
        }
Esempio n. 7
0
 /// <summary>
 /// Add this forcefield to the instantiated topology.
 /// </summary>
 /// <param name="parentTopology">The topology.</param>
 /// <param name="residue">The atom group this forcefield is associated with.</param>
 /// <param name="context">The spawn context this forcefield is associated with.</param>
 public void AddToTopology(InstantiatedTopology parentTopology, IResidue residue, ref SpawnContext context)
 {
     //TODO generalize this to multiple templates/atom groups.
     parentTopology.ForceFieldTerms.Add(this);
 }