Beispiel #1
0
        public void Execute(PowerUpDefinition powerUpDefinition)
        {
            var powerUpView = collisionInstantiator.Execute <PowerUpView>(powerUpDefinition);

            powerUpView.MainRectTransform.SetParent(GameProvider.GetGameView().GetPowerUpsContainer());
            powerUpView.MainRectTransform.ScaleOne();
            powerUpView.Init(powerUpDefinition);
        }
        private void DrawPowerUp(PowerUpDefinition powerUpDefinition)
        {
            var serializedObject = new SerializedObject(powerUpDefinition);

            EditorGUILayout.PropertyField(serializedObject.FindProperty("Name"), true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("Prefab"), true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("FromPosition"), true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("ToPosition"), true);
            serializedObject.ApplyModifiedProperties();
        }
Beispiel #3
0
        /// <summary>
        /// Creates elements by a power up defintion.
        /// </summary>
        /// <param name="powerUpDef">The power up definition.</param>
        /// <param name="attributeHolder">The attribute holder.</param>
        /// <returns>The elements which represent the powerup.</returns>
        public static IEnumerable <PowerUpWrapper> CreateByPowerUpDefintion(PowerUpDefinition powerUpDef, AttributeSystem attributeHolder)
        {
            if (powerUpDef.Boost.ConstantValue != null)
            {
                yield return(new PowerUpWrapper(powerUpDef.Boost.ConstantValue, powerUpDef.TargetAttribute, attributeHolder));
            }

            if (powerUpDef.Boost.RelatedValues != null)
            {
                foreach (var relationship in powerUpDef.Boost.RelatedValues)
                {
                    yield return(new PowerUpWrapper(attributeHolder.CreateRelatedAttribute(relationship, attributeHolder), powerUpDef.TargetAttribute, attributeHolder));
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// Creates elements by a <see cref="PowerUpDefinition"/>.
        /// </summary>
        /// <param name="powerUpDef">The power up definition.</param>
        /// <param name="attributeHolder">The attribute holder.</param>
        /// <returns>The elements which represent the power-up.</returns>
        public static IEnumerable <PowerUpWrapper> CreateByPowerUpDefinition(PowerUpDefinition powerUpDef, AttributeSystem attributeHolder)
        {
            if (powerUpDef.Boost?.ConstantValue != null)
            {
                yield return(new PowerUpWrapper(
                                 powerUpDef.Boost.ConstantValue,
                                 powerUpDef.TargetAttribute ?? throw Error.NotInitializedProperty(powerUpDef, nameof(PowerUpDefinition.TargetAttribute)),
                                 attributeHolder));
            }

            if (powerUpDef.Boost?.RelatedValues != null)
            {
                foreach (var relationship in powerUpDef.Boost.RelatedValues)
                {
                    yield return(new PowerUpWrapper(
                                     attributeHolder.CreateRelatedAttribute(relationship, attributeHolder),
                                     powerUpDef.TargetAttribute ?? throw Error.NotInitializedProperty(powerUpDef, nameof(PowerUpDefinition.TargetAttribute)),
                                     attributeHolder));
                }
            }
        }
Beispiel #5
0
 public void Init(PowerUpDefinition powerUpDefinition)
 {
     this.powerUpDefinition = powerUpDefinition;
 }
Beispiel #6
0
 public void Init(PowerUpDefinition powerUpDefinition)
 {
     presenter.Init(powerUpDefinition);
 }