I have a list which contains 2 variables:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class SlowOrder //holds the values for slows
{
public float Speed;
public float Duration;
public SlowOrder(float speed, float duration)
{
Speed = speed;
Duration = duration;
}
}
public class UnityTest : MonoBehaviour
{
public List<SlowOrder> slowOrder = new List<SlowOrder>();
public float walking;
public float currentSlowDuration;
void SlowEffect(List<float> slowHolder) //sendmessage from projectiles //list [0] = percent [1] = duration
{
float wTemp = walking - (walking * slowHolder [0]); //new slowed walking speed
float dTemp = currentSlowDuration - Time.time; //current slowed duration, left
slowOrder.Add (new SlowOrder (wTemp, slowHolder[1] + Time.time));
for(int i = 0; i < slowOrder.Count; i++) //debugging
{
Debug.Log ("speed = " + slowOrder_.Speed + " / duration = " + slowOrder*.Duration);*_
* }*
* slowHolder.Clear (); //clears this methods list “SlowOrder” for next*
* }*
}
I get this Error:
ArgumentException: does not implement right interface
But only when I add to the list and then debugs. The first fire dose not give errors.
I used this type of list and not a dictionary cause i will have duplicate keys and values.
Still learning scripting, so be nice and simple.
James